PURPOSE: We aim to develop and validate an interpretable machine-learning model that can provide critical information for the clinical treatment of critically ill patients with acute myocardial infarction (AMI). METHODS: All data was extracted from the multi-centre database (training and internal validation cohorts: MIMIC-III/-IV, external validation cohort: eICU). After comparing different machine-learning models and several unbalanced data processing methods, the model with the best performance was selected. Lasso regression was used to build a compact model. Seven evaluation methods, PR, and ROC curves were used to assess the model. The SHapley Additive exPlanations (SHAP) values were calculated to evaluate the feature's importance. The SHAP plots were adopted to explain and interpret the results. A web-based tool was developed to help application. RESULTS: A total of 12,170 critically ill patients with AMI were included. The balance random forest (BRF) model had the best performance in predicting in-hospital mortality. The compact model did not differ from the full variable model in performance (AUC: 0.891 vs 0.885, P = 0.06). The external validation results also demonstrated the stability of the model (AUC: 0.784). All SHAP plots have shown the contribution ranking of all variables in the model, the relationship trend between variables and outcomes, and the interaction mode between variables. A web-based tool is constructed that can provide individualized risk stratification probabilities (https://github.com/huangtao36/BRF-web-tool) . CONCLUSION: We built the BRF model and the web-based tool by the model algorithm. The model effect has been verified externally. The tool can help clinical decision-making.