The combined effects of corrosion, temperature, and pressure can cause safety issues such as shortened lifespan and failure of offshore high temperature and high pressure oil and gas well strings. This paper focuses on a certain sea area and conducts experiments on CO2 corrosion of different string materials under different temperature and partial pressure conditions. Combined with the two-phase flow wellbore temperature and pressure-coupling model, a corrosion rate prediction model based on Back Propagation Neural Network optimized by Genetic Algorithm (GA-BPNN) is established for predicting corrosion rate along the wellbore depth. At the same time, based on the API 5C3 standard, considering the degradation effect of thermally induced metal string strength and the influence of environmental pressure, a safety evaluation model of offshore oil and gas well string based on corrosion rate prediction was established, and analysis of the change law of residual strength of the string and prediction of remaining life under the influence of different factors were carried out.