Strontium titanate (SrTi O3 ) is regarded as an essential material for oxide electronics. One of its many remarkable features is the subtle structural phase transition, driven by the antiferrodistortive lattice mode, from a high-temperature cubic phase to a low-temperature tetragonal phase. Classical molecular dynamics (MD) simulation is an efficient technique to reveal atomistic features of phase transition, but its application is often limited by the accuracy of empirical interatomic potentials. Here, we develop an accurate deep potential (DP) model of SrTi O3 based on a machine learning method using data from first-principles density functional theory (DFT) calculations. The DP model has DFT-level accuracy, capable of performing efficient MD simulations and accurate property predictions. Using the DP model, we investigate the temperature-driven cubic-to-tetragonal phase transition and construct the in-plane biaxial strain-temperature phase diagram of SrTi O3 . The simulations demonstrate that the strain-induced ferroelectric (FE) phase is characterized by two order parameters, FE distortion and antiferrodistortion, and the FE phase transition has both displacive and order-disorder characters. In this paper, we lay the foundation for the development of accurate DP models of other complex perovskite materials.