Abstract Background Heart failure (HF) is a global problem, affecting more than 26 million people worldwide. This study evaluated the performance of 10 machine learning (ML) algorithms and chose the best algorithm to predict mortality and readmission of HF patients by using The Fasa Registry on Systolic HF (FaRSH) database. Hypothesis ML algorithms may better identify patients at increased risk of HF readmission or death with demographic and clinical data. Methods Through comprehensive evaluation, the best‐performing model was used for prediction. Finally, all the trained models were applied to the test data, which included 20% of the total data. For the final evaluation and comparison of the models, five metrics were used: accuracy, F1‐score, sensitivity, specificity and Area Under Curve (AUC). Results Ten ML algorithms were evaluated. The CatBoost (CAT) algorithm uses a series of decision tree models to create a nonlinear model, and this CAT algorithm performed the best of the 10 models studied. According to the three final outcomes from this study, which involved 2488 participants, 366 (14.7%) of the patients were readmitted to the hospital, 97 (3.9%) of the patients died within 1 month of the follow‐up, and 342 (13.7%) of the patients died within 1 year of the follow‐up. The most significant variables to predict the events were length of stay in the hospital, hemoglobin level, and family history of MI. Conclusions The ML‐based risk stratification tool was able to assess the risk of 5‐year all‐cause mortality and readmission in patients with HF. ML could provide an explicit explanation of individualized risk prediction and give physicians an intuitive understanding of the influence of critical features in the model.