To enhance the accuracy and applicability of a three-dimensional(3D)phase retrieval algorithm in X-ray in-line phase-contrast computed tomography(CT)imaging,this study introduces a constraint-based optimization algorithm for the 3D contrast transfer function.The algorithm imposes constraints associated with sample information in 3D space and uses an iterative optimization method to improve the quality of 3D phase reconstruction.Simulation findings indicate that the constraint-based algorithm demonstrates improved accuracy in phase reconstruction,robust noise resistance,and a broader range of applicability compared with the traditional 3D contrast transfer function algorithm.The algorithm is expected to facilitate the application of X-ray in-line phase contrast CT imaging in various fields,including materials science and biomedical research.