This study aims to develop and validate a machine learning (ML) predictive model for assessing mortality in patients with malignant tumors and hyperkalemia (MTH). We extracted data on patients with MTH from the Medical Information Mart for Intensive Care-IV, version 2.2 (MIMIC-IV v2.2) database. The dataset was split into a training set (75%) and a validation set (25%). We used the Least Absolute Shrinkage and Selection Operator (LASSO) regression to identify potential predictors, which included clinical laboratory indicators and vital signs. Pearson correlation analysis tested the correlation between predictors. In-hospital death was the prediction target. The Area Under the Curve (AUC) and accuracy of the training and validation sets of 7 ML algorithms were compared, and the optimal 1 was selected to develop the model. The calibration curve was used to evaluate the prediction accuracy of the model further. SHapley Additive exPlanations (SHAP) and Local Interpretable Model-agnostic Explanations (LIME) enhanced model interpretability. 496 patients with MTH in the Intensive Care Unit (ICU) were included. After screening, 17 clinical features were included in the construction of the ML model, and the Pearson correlation coefficient was <0.8, indicating that the correlation between the clinical features was small. eXtreme Gradient Boosting (XGBoost) outperformed other algorithms, achieving perfect scores in the training set (accuracy: 1.000, AUC: 1.000) and high scores in the validation set (accuracy: 0.734, AUC: 0.733). The calibration curves indicated good predictive calibration of the model. SHAP analysis identified the top 8 predictive factors: urine output, mean heart rate, maximum urea nitrogen, minimum oxygen saturation, minimum mean blood pressure, maximum total bilirubin, mean respiratory rate, and minimum pH. In addition, SHAP and LIME performed in-depth individual case analyses. This study demonstrates the effectiveness of ML methods in predicting mortality risk in ICU patients with MTH. It highlights the importance of predictors like urine output and mean heart rate. SHAP and LIME significantly enhanced the model’s interpretability.