OBJECTIVE: Early prediction of long-term outcomes in patients with systemic lupus erythematosus (SLE) remains a great challenge in clinical practice. Our study aims to develop and validate predictive models for the mortality risk. METHODS: This observational study identified patients with SLE requiring hospital admission from the Medical Information Mart for Intensive Care (MIMIC-IV) database. We downloaded data from Fujian Provincial Hospital as an external validation set. Variable selection was performed using the Least Absolute Shrinkage and Selection Operator (LASSO) regression. Then, we constructed two predictive models: a traditional nomogram based on logistic regression and a machine learning model employing a stacking ensemble approach. The predictive ability of the models was evaluated by the areas under the receiver operating characteristic curve (AUC) and the calibration curve. RESULTS: A total of 395 patients and 100 patients were enrolled respectively from MIMIC-IV database and the validation cohort. The LASSO regression identified 18 significant variables. Both models demonstrated good discrimination, with AUCs above 0.8. The machine learning model outperformed the nomogram in terms of precision and specificity, highlighting its potential superiority in risk prediction. The SHapley additive explanations analysis further elucidated the contribution of each variable to the model's predictions, emphasising the importance of factors such as urine output, age, weight and alanine aminotransferase. CONCLUSIONS: The machine learning model provides a superior tool for predicting mortality risk in patients with SLE, offering a basis for clinical decision-making and potential improvements in patient outcomes.