The mechanism study of steel pipe welding in Dianzhong water diversion project is very complicated, and there are many process parameters affecting the temperature distribution of high-frequency heating of welded steel pipe, and the degree of influence and the influence law are not the same. In this paper, Abaqus software is used to carry out the finite element analysis of the steel pipe welding process, and the displacement variational method (i.e., Ritz method) is introduced to derive the radial displacement of the steel pipe when it is subjected to the action of the centralized force, so as to realize the finite element simulation of the welding process of the steel pipe. At the same time, the optimization of the welding process parameters of the steel pipe is realized by combining the radial basis function neural network (RBF) and particle swarm algorithm (PSO). The simulation results show that the Von mise equivalent residual stress at the weld seam reaches the nominal yield strength of the material on both the internal and external surfaces of the steel pipe, while the axial residual stress has a very different distribution law on the internal and external walls of the steel pipe, which belongs to the tensile stress and weld residual compressive stress at the weld seams on the internal and external walls of the steel pipe, which are about 0.4 times the yield strength of the material and 0.7 times the yield strength of the material, respectively. The ring residual stress distribution law of the steel pipe is similar to the axial residual stress, but both reach the nominal yield strength of the material. Through parameter optimization, this paper determines that when the opening angle is 5°, the current frequency is 217.35 kHz, and the distance from the coil to the V-point is 252 mm, the corresponding optimization target values are all smaller, and the welding quality of the corresponding weld seam is better. The research in this paper provides a theoretical basis for further improving the welding quality of steel pipe in Dianzhong water diversion project.