Objectives: To explore the application of machine learning in the diagnosis of endometriosis.Methods: A total of 106 patients with endometriosis and 203 patients with non-endometriosis (simple cysts and simple fibroids) admitted to Shunyi Women's and Children's Hospital of Beijing Children's Hospital between January 2017andSeptember 2022 were included. All patients were free of comorbidities and confirmed by postoperative pathology to be endometriosis and non-endometriosis (fibroids and simple cysts), and the two groups were compared. We compared the baseline data, WBC, NLR (neutrophils/lymphocytes), PLR (platelets/lymphocytes), LMR(lymphocytes/monocytes), MPV, HB, CA125, CA199, coagulation, and other serological indexes of the two groups, and established an optimal model to predict whether or not the patients had endometriosis through artificial intelligence algorithms, with a view to providing new ideas for clinical diagnosis and treatment of endometriosis.Results: Random forests were found to be more advantageous than decision trees, logitboost, artificial neural networks, plain Bayes, support vector machines, and linear regression by machine learning methods. By random forest algorithm modeling, ca125combined with NLR predicted endometriosis better than ca125 alone. ca125combined with NLR predicted endometriosis with 78. 16% accuracy, 86.21%sensitivity, and 0.85 AUC(P<0.05).