Heart disease stands as a prominent contributor to global mortality, as indicated by data released by the World Health Organization (WHO). In 2019 alone, an estimated 17.9 million individuals succumbed to cardiovascular disease, accounting for 32% of all worldwide deaths. Of these fatalities, 85% were attributed to heart disease and stroke. Individuals harboring the potential for heart failure often persist in unhealthy lifestyles, regardless of their awareness of underlying heart conditions. To address this issue, the research explores the application of machine learning to identify an optimal method for classifying heart failure patients, employing the Naive Bayes technique. This algorithm has found extensive use in the health sector, demonstrating success in classifying various conditions such as hepatitis, stroke, respiratory infections, and more. The Naive Bayes algorithm, applied in this study, exhibited notable accuracy, precision, sensitivity, and overall classification efficacy. Specifically, the classification accuracy for heart failure patients reached 74.58%, the precision level was 97.67%, sensitivity achieved 75%, and the AUC (Area Under ROC Curve) stood at 0.857, indicating excellent classification within the 0.80 to 0.90 range. These findings can serve as an early warning system for individuals at risk of heart failure.