AIMS: While few traditional scores are available for risk stratification of patients hospitalized for acute heart failure (AHF), the potential benefit of machine learning (ML) is not well established. We aimed to assess the feasibility and accuracy of a supervised ML model including environmental factors to predict in-hospital major adverse events (MAEs) in patients hospitalized for AHF. METHODS AND RESULTS: In April 2021, a French national prospective multicentre study included all consecutive patients hospitalized in intensive cardiac care unit. Patients admitted for AHF were included in the analyses. A ML model involving automated feature selection by least absolute shrinkage and selection operator (LASSO) and model building with a random forest (RF) algorithm was developed. The primary composite outcome was in-hospital MAE defined by death, resuscitated cardiac arrest, or cardiogenic shock requiring assistance. Among 459 patients included (age 68 ± 14 years, 68% male), 47 experienced in-hospital MAE (10.2%). Seven variables were selected by LASSO for predicting MAE in the training data set ( CONCLUSION: Our ML model including in particular environmental variables exhibited a better performance than traditional statistical methods to predict in-hospital outcomes in patients admitted for AHF. STUDY REGISTRATION: ClinicalTrials.gov identifier: NCT05063097.