Background: Mental health issues among undergraduates have gained attention inrecent years due to their rising incidence. Healthy lifestyle components like sleepquality, diet, physical activity, substance abuse, and social support may affect mentalhealth. Thus, recognizing the most important components of a healthy lifestyle allows relevant parties to execute suitable treatments. Objective: This study aims toidentify predictors of a healthy lifestyle on mental health. A cross-sectional studywas carried out on a randomly selected sample of 180 undergraduate students aged18 to 30. Significant predictors of healthy lifestyle components were identified usingAHLQ and DASS 21 instruments. Methods: This research is quantitative researchwith a nested case-control study design, using electronic medical record (EMR) datafrom the Central Java Provincial Hospital in 2023. The variables in this study weregender, age, education level, employment status, marital status, health insurancestatus, BMI, DM diet, duration of DM, hypertension, other diseases, current bloodglucose, and HbA1c. The analysis used was univariate, bivariate, and multivariateanalysis (logistic regression). Results: The findings indicate a significant relationship between a healthy diet and mental health, and a healthy diet contributes 25% ofvariances, while 29% of mental health variance was attributed to the combinationof a healthy diet and PA. Furthermore, 31% of mental health variance is attributedto sleep quality variables, and a combination of healthy diet, PA, sleep quality, andsubstance abuse contributes to 34% of mental health variance. Conclusion: Thisstudy provides insights to stakeholders in terms of incorporating healthy lifestylecomponents in mental health intervention strategies for undergraduate students. Itwas concluded that such interventions should focus on promoting a healthy dietsince it is the most significant measure of good mental health.