ABSTRACT: The present study proposes a classification model for the differential diagnosis of primary insomnia (PI) and delayed sleep phase disorder (DSPD), applying machine learning methods to circadian parameters obtained from ambulatory circadian monitoring (ACM). Nineteen healthy controls and 242 patients (PI = 184; DSPD = 58) were selected for a retrospective and non-interventional study from an anonymized Circadian Health Database (https://kronowizard.um.es/). ACM records wrist temperature (T), motor activity (A), body position (P), and environmental light exposure (L) rhythms during a whole week. Sleep was inferred from the integrated variable TAP (from temperature, activity, and position). Non-parametric analyses of TAP and estimated sleep yielded indexes of interdaily stability (IS), intradaily variability (IV), relative amplitude (RA), and a global circadian function index (CFI). Mid-sleep and mid-wake times were estimated from the central time of TAP-L5 (five consecutive hours of lowest values) and TAP-M10 (10 consecutive hours of maximum values), respectively. The most discriminative parameters, determined by ANOVA, Chi-squared, and information gain criteria analysis, were employed to build a decision tree, using machine learning. This model differentiated between healthy controls, DSPD and three insomnia subgroups (compatible with onset, maintenance and mild insomnia), with accuracy, sensitivity, and AUC >85%. In conclusion, circadian parameters can be reliably and objectively used to discriminate and characterize different sleep and circadian disorders, such as DSPD and OI, which are commonly confounded, and between different subtypes of PI. Our findings highlight the importance of considering circadian rhythm assessment in sleep medicine.