In order to solve the problem of ship magnetic field modeling, a magnetic dipole array model was established, a modeling inversion equation system was constructed, and the degree of sickness of the solved equation system under different numbers of magnetic dipoles was quantitatively analyzed based on the coefficient matrix conditional number. In order to solve the problem of the pathological system of magnetic field modeling equations, a regularization method based on the conjugate gradient least squares method was designed to invert the magnetic moment parameters of the magnetic dipole. In order to analyze the applicability of the regularization method in magnetic field modeling inversion, the modeling accuracy, modeling robustness, calculation time and other metrics are defined. A detailed test of the ship model was designed, and the magnetic field passing characteristics of the two types of ship models at different positive and horizontal conditions at two depths were measured. Under the condition of no interference and interference, the conjugate gradient least squares method is used to invert the magnetic field model, and the numerical test analysis shows that the conjugate gradient least squares method has higher applicability than the generalized inverse solution method and the stepwise regression method. Under the condition of interference, the relative error of magnetic field fitting of the array model with 15 magnetic dipoles is 0.1537, and the relative error of magnetic field extrapolation is 0.0868.