China's rapid urbanization and internal migration have increased the need for effective healthcare services for migrants. This study investigated the potential of China's family doctor contracted service system to improve migrant health, considering the unique healthcare access challenges they face. Using data from the China Migrants Dynamic Survey (CMDS) 2018, a cross-sectional analysis was conducted to assess the impact of the family doctor contracted service system on migrant health while also considering the mediating role of health education in this relationship. Statistical analysis included descriptive statistics, bivariate analysis, and a double machine learning model to estimate treatment effects. The analysis revealed a positive association between the family doctor contracted service system and migrant self-rated health status. Machine learning models consistently supported this finding, indicating the system's role in enhancing migrants' health perceptions. Furthermore, health education emerged as a significant mediator, with family doctor contracted services positively influencing migrants' access to health education, subsequently improving their health status. China's family doctor contracted service system holds promise for addressing health disparities among migrants. Strengthening promotion efforts, enhancing health education, and implementing effective policy evaluation mechanisms are crucial for leveraging primary healthcare initiatives to mitigate health disparities among migrants in China.