This retrospective study analyzed data of 2,434 stroke patients from the MIMIC-IV database in the ICU, divided into a training set (1,706 patients) and a validation set (728 patients) in a 7:3 ratio. Multivariate logistic regression identified four independent predictors of impaired consciousness (all p < 0.001): length of hospital stay (95% CI: 1.02-1.06), mechanical ventilation (95% CI: 0.29-0.72), nasogastric probe (95% CI: 1.61-3.79), and SOFA score (95% CI: 1.47-1.74). Using 11 machine learning algorithms, a model was developed to predict the risk of disorders of consciousness. The LightGBM model achieved the best performance: an AUC of 0.824 in the training set and 0.795 in the validation set, Brier scores of 0.132 and 0.140, respectively. Calibration curves showed good agreement of predictions with real values, and decision curve analysis confirmed clinical applicability. The LightGBM model can serve as a tool for early identification and risk stratification of disorders of consciousness in these patients.