In the modern world, wearable smart devices are continuously used to monitor people’s health. This study aims to develop an automatic mental stress detection system for researchers based on Electrocardiogram (ECG) signals from smart T-shirts using machine learning classifiers. We used 20 subjects, including 10 from mental stress (after twelve hours of continuous work in the laboratory) and 10 from normal (after completing the sleep or without any work). We also applied three scoring techniques: Chalder Fatigue Scale (CFS), Specific Fatigue Scale (SFS), Depression, Anxiety, and Stress Scale (DASS), to confirm the mental stress. The total duration of ECG recording was 1800 min, including 1200 min during mental stress and 600 min during normal. We calculated two types of features, such as demographic and extracted by ECG signal. In addition, we used Decision Tree (DT), Naive Bayes (NB), Random Forest (RF), and Logistic Regression (LR) to classify the intra-subject (mental stress and normal) and inter-subject classification. The DT leave-one-out model has better performance in terms of recall (93.30%), specificity (96.70%), precision (94.40%), accuracy (93.30%), and F1 (93.50%) in the intra-subject classification. Additionally, The classification accuracy of the system in classifying inter-subjects is 94.10% when using a DT classifier. However, our findings suggest that the wearable smart T-shirt based on the DT classifier may be used in big data applications and health monitoring. Mental stress can lead to mitochondrial dysfunction, oxidative stress, blood pressure, cardiovascular disease, and various health problems. Therefore, real-time ECG signals help assess cardiovascular and related risk factors in the initial stage based on machine learning techniques.