Objective: The aim of this study is to establish a random forest model to detect active and quiescent phases of patients with Thyroid-associated ophthalmopathy (TAO) and to evaluate its diagnostic performance.Methods:A total of 146 patients (292 eyes) who were diagnosed with TAO and were treated in the Ophthalmology Outpatient Clinic of Beijing TongRen hospital were retrospectively included in the study. We took the clinical activity score of TAO as the target; took gender, age, smoking status, I-131 treatment history, thyroid nodules, thyromegaly, thyroid hormone and TSH-receptor antibodies (TRAb) as predictive characteristic variables to establish a random forest model. The proportion of the training group to the testing group was 7:3. We analyzed the model’s accuracy, precision, sensitivity, specificity, positive predictive value (PPV), negative predictive value (PPV), F1 score and out-of-bag (OOB) error, with the accuracy, the brier loss and the area under the receiver operating characteristic curve compared with logistic regression model.Results:Our model has an accuracy of 0.93, a sensitivity of 0.88, a specificity of 0.96, a positive predictive value of 0.94, a negative predictive value of 0.93, an F1 score of 0.91 and an OOB error of 0.12. The accuracy of the random forest model and the logistic regression model were 0.93 and 0.79, respectively, the brier loss were 0.06 and 0.20, and the area under the receiver operating characteristic curve were 0.95 and 0.86.Conclusion:By integrating these high-risk factors, the random forest algorithm can be used as a complementary diagnostic method to determine the activity of TAO, showing prominent diagnostic performance.