Machine learning and the internet of things are rapidly gaining popularity around the world, particularly in the healthcare area. Heart disease is one of the deadliest diseases, and early detection is critical for many medical professionals in order to save their patients' lives. The research's key contributions are a comparative comparison of various machine learning models for identifying heart disease with higher accuracy than existing methods. Three models have been introduced for this purpose: Naive Bayes (NB), Random Forest (RF), and Support Vector Machine (SVM). For a more exact evaluation, their performances were evaluated and compared using several criteria. The RF is the best ideal model for prediction, according to the comparison research, since it has a higher prediction potential than other models, with a 100% accuracy on various cardiac illnesses. The dataset came from the University of California, Irvine's heart disease repository (UCI).