Depression represents a major global public health concern, affecting hundreds of millions of individuals worldwide. The World Health Organization forecasts that, by 2030, depression will emerge as the primary driver of the global healthcare challenge. Consequently, the identification of biomarkers specific to anxiety (ANX), depression (DEP), and somatic symptom disorder (SSD) is crucial for early and accurate diagnosis and timely treatment. Here, we explicited a diagnosis model to screen the patients by a salivary biomarkers panel in the of a cohort consisting of healthy individuals and patients with ANX, DEP, and SSD, through a microfluidic chip. The detection results show that the expression levels of inflammatory cytokines were elevated in patients compared with healthy individuals. A four-biomarker panel was employed to train the machine learning (ML) model (M4D) based on the random forest (RF) algorithm for early and accurate differential diagnosis, which includes tumor necrosis factor-alpha (TNF-alpha), interleukin-8 (IL-8), interleukin-1 beta (IL-1 beta) and Interferon-gamma (IFN-gamma). It can identify the specific type of mental disorder for an individual with AUC >0.98, without invasive procedures. The diagnostic accuracy in the test set reached 92.22%. The proposed non-invasive diagnostic method presents promising applications in making precise diagnosis of mental disorders.