Emerging telemedicine trends, such as the Internet of Medical Things (IoMT), facilitate regular and efficient interactions between medical devices and computing devices. The importance of IoMT comes from the need to continuously monitor patients' health conditions in real-time during normal daily activities, which is realized with the help of various wearable devices and sensors. One major health problem is workplace stress, which can lead to cardiovascular disease or psychiatric disorders. Therefore, real-time monitoring of employees' stress in the workplace is essential. Stress levels and the source of stress could be detected early in the fog layer so that the negative consequences can be mitigated sooner. However, overwhelming the fog layer with extensive data will increase the load on fog nodes, leading to computational challenges. This study aims to reduce fog computation by proposing machine learning (ML) models with two phases. The first phase of the ML model assesses the priority of the situation based on the stress level. In the second phase, a classifier determines the cause of stress, which was either interruptions or time pressure while completing a task. This approach reduced the computation cost for the fog node, as only high-priority records were transferred to the fog. Low-priority records were forwarded to the cloud. Four ML approaches were compared in terms of accuracy and prediction speed: Knearest neighbors (KNN), a support vector machine (SVM), a bagged tree (BT), and an artificial neural network (ANN). In our experiments, ANN performed best in both phases because it scored an F 1 score of 99.97% and had the highest prediction speed compared with KNN, SVM, and BT.