BackgroundMild cognitive impairment (MCI) is considered a preclinical stage of Alzheimer’s disease (AD). People with MCI have a higher risk of developing dementia than healthy people. As one of the risk factors for MCI, stroke has been actively treated and intervened. Therefore, selecting the high-risk population of stroke as the research object and discovering the risk factors of MCI as early as possible can prevent the occurrence of MCI more effectively.MethodsThe Boruta algorithm was used to screen variables, and eight machine learning models were established and evaluated. The best performing models were used to assess variable importance and build an online risk calculator. Shapley additive explanation is used to explain the model.ResultsA total of 199 patients were included in the study, 99 of whom were male. Transient ischemic attack (TIA), homocysteine, education, hematocrit (HCT), diabetes, hemoglobin, red blood cells (RBC), hypertension, prothrombin time (PT) were selected by Boruta algorithm. Logistic regression (AUC = 0.8595) was the best model for predicting MCI in high-risk groups of stroke, followed by elastic network (ENET) (AUC = 0.8312), multilayer perceptron (MLP) (AUC = 0.7908), extreme gradient boosting (XGBoost) (AUC = 0.7691), and support vector machine (SVM) (AUC = 0.7527), random forest (RF) (AUC = 0.7451), K-nearest neighbors (KNN) (AUC = 0.7380), decision tree (DT) (AUC = 0.6972). The importance of variables suggests that TIA, diabetes, education, and hypertension are the top four variables of importance.ConclusionTransient ischemic attack (TIA), diabetes, education, and hypertension are the most important risk factors for MCI in high-risk groups of stroke, and early intervention should be performed to reduce the occurrence of MCI.