Machine learning has demonstrated potential in addressing complex nonlinear changes in risk assessment. However, further exploration is needed to enhance model interpretability and optimize performance. Therefore, this study aims to develop a novel workplace risk assessment framework. By utilizing the SHapley Additive exPlanations (SHAP) analysis method and ensemble learning algorithms, the framework maps characteristic attributes to risk levels. Reliability validation of the framework and analysis of critical attribute components are conducted using accidents in Chinese coal enterprises as a case study, which represents one of the most serious occupational hazards. The results indicate that addressing interpretability issues of ensemble learning algorithms yields a model capable of accurately assessing workplace risk and understanding model decision-making processes. Comparative experiments show that the model achieves an accuracy of up to 98.3%, confirming its robust performance. The outcomes of the SHAP model for feature importance facilitate the identification of critical attributes that explain causal relationships leading to risk-level findings. This provides valuable accident prevention strategies to minimize occupational injuries and losses.