In digital holographic imaging measurement, three-dimensional information, such as shape, height, and refractive index distribution, can be obtained by analyzing the phase information of the object to be measured. However, the misalignment of the measurement optical path, environmental disturbances, and phase differences of the optical components lead to phase distortions that seriously affect the accuracy of the measurement. In order to accurately recover the real phase information, a phase distortion compensation method based on Residual Squeeze-and-Excitation Nested U-Net Architecture (RS-UNet++) is proposed in this paper. This method takes U-Net++ as the basic network architecture, uses the histogram threshold segmentation algorithm to generate the binary image of the phase, and extracts the phase distortion scatter data by the random library selection method. The scatter data are then combined with the phase data generated by random matrix enlargement and Gaussian function superposition to train the network model. Finally, the simulation and experiment are used to verify the effectiveness and accuracy of the proposed method. The results show that compared with the IRLS, Poly-fit, PCA, CNN, and Res-UNet methods, the proposed method achieves the optimal phase distortion compensation effect in terms of standard deviation, global error, and Pearson’s correlation coefficient and greatly improves the accuracy of phase recovery.