Introduction: It is known that patients with immune-abnormal co-pregnancies are at a higher risk of adverse pregnancy outcomes. Traditional pregnancy risk management systems have poor prediction abilities for adverse pregnancy outcomes in such patients, with many limitations in clinical application. In this study, we will use machine learning to screen high-risk factors for miscarriage and develop a miscarriage risk prediction model for patients with immune-abnormal pregnancies. This model aims to provide an adjunctive tool for the clinical identification of patients at high risk of miscarriage and to allow for active intervention to reduce adverse pregnancy outcomes.Methods: Patients with immune-abnormal pregnancies attending Sichuan Provincial People’s Hospital were collected through electronic medical records (EMR). The data were divided into a training set and a test set in an 8:2 ratio. Comparisons were made to evaluate the performance of traditional pregnancy risk assessment tools for clinical applications. This analysis involved assessing the cost-benefit of clinical treatment, evaluating the model's performance, and determining its economic value. Data sampling methods, feature screening, and machine learning algorithms were utilized to develop predictive models. These models were internally validated using 10-fold cross-validation for the training set and externally validated using bootstrapping for the test set. Model performance was assessed by the area under the characteristic curve (AUC). Based on the best parameters, a predictive model for miscarriage risk was developed, and the SHapley additive expansion (SHAP) method was used to assess the best model feature contribution.Results: A total of 565 patients were included in this study on machine learning-based models for predicting the risk of miscarriage in patients with immune-abnormal pregnancies. Twenty-eight risk warning models were developed, and the predictive model constructed using XGBoost demonstrated the best performance with an AUC of 0.9209. The SHAP analysis of the best model highlighted the total number of medications, as well as the use of aspirin and low molecular weight heparin, as significant influencing factors. The implementation of the pregnancy risk scoring rules resulted in accuracy, precision, and F1 scores of 0.3009, 0.1663, and 0.2852, respectively. The economic evaluation showed a saving of ¥7,485,865.7 due to the model.Conclusion: The predictive model developed in this study performed well in estimating the risk of miscarriage in patients with immune-abnormal pregnancies. The findings of the model interpretation identified the total number of medications and the use of other medications during pregnancy as key factors in the early warning model for miscarriage risk. This provides an important basis for early risk assessment and intervention in immune-abnormal pregnancies. The predictive model developed in this study demonstrated better risk prediction performance than the Pregnancy Risk Management System (PRMS) and also demonstrated economic value. Therefore, miscarriage risk prediction in patients with immune-abnormal pregnancies may be the most cost-effective management method.