Water-side oxidative corrosion of zirconium alloy is a key problem in the design of nuclear fuel rods cladding materials in pressurised water reactors (PWRs), and its corrosion resistance is one of the main factors limiting service life. At present, Zr-Sn-Nb system alloys are still the main development direction of advanced zirconium alloys. Sn and Nb can exhibit a variety of valence states in the oxide film of the cladding and significantly affect the stability of ZrO2. However, the influence mechanism of Sn and Nb on the fraction of t-ZrO2 and the t-m phase transition is unclear. In this work, the lattice properties, formation enthalpies, and oxygen vacancy formation energy of ZrO2 under the doping conditions of Sn and Nb with different valence states are calculated based on the first-principles, and the influence mechanism of Sn and Nb on the stability of ZrO2 is revealed at an atomic scale. The results show that there is a significant difference between the effects of Sn and Nb, as well as between low-valent and high-valent elements. Sn2+ and Nb3+ cause lattice swelling to be significantly distorted, Nb5+ causes lattice to shrink, which contributes to reducing the stresses within the film, and Sn4+ leads the lattice to slightly swell. The low-valent elements all make ZrO2 less stable and are unfavourable for the stability of t-ZrO2 relative to m-ZrO2. The high-valent Nb(5+)and Sn4+ promote the relative stability of t-ZrO2, thus inhibiting the t-m phase transition, with Nb5+ having a significant effect and Sn4+ having a weak effect. The relative stability of t-ZrO2 increases with pressure rising in a range of 0-3.5 GPa. Compared with high-valent elements, the low-valent elements are favourable for introduing oxygen vacancies into t-ZrO2, thus stabilising the interfacial t-ZrO2 and enhancing the corrosion resistance of the cladding. By investigating the electronic structure, it is found that the oxygen vacancy formation energy is positively correlated with the magnitude of charge transfer (or degree of electron localisation) between the alloying element ion and the oxygen vacancy. These results contribute to optimizing the composition and designing the structure for corrosion resistance of zirconium alloys.