Artificial Intelligence (AI) is finding increasing application in healthcare monitoring. Machine learning systems are utilized for monitoring patient health through the use of IoT sensor, which keep track of the physiological state by way of various health data. Thus, early detection of any disease or derangement can aid doctors in saving patients’ lives. However, there are some challenges associated with predicting health status using the common algorithms, such as time requirements, chances of errors, and improper classification. We propose an Artificial Krill Herd based on the Random Forest (AKHRF) technique for monitoring patients’ health and eliciting an optimal prescription based on their health status. To begin with, various patient datasets were collected and trained into the system using IoT sensors. As a result, the framework developed includes four processes: preprocessing, feature extraction, classification, and result visibility. Additionally, preprocessing removes errors, noise, and missing values from the dataset, whereas feature extraction extracts the relevant information. Then, in the classification layer, we updated the fitness function of the krill herd to classify the patient’s health status and also generate a prescription. We found that the results from the proposed framework are comparable to the results from other state-of-the-art techniques in terms of sensitivity, specificity, Area under the Curve (AUC), accuracy, precision, recall, and F-measure.