Background and Aim. As an integral matter at the global level, sleep quality can be pertinent to some factors, namely, depression and anxiety. Considering this critical issue and its effects and consequences, the current cross-sectional study has centralized its aim on assessing the association between depression and anxiety with sleep quality in freshmen students in the context of Neyshabur University of Medical Sciences (NUMS). Methods. A total number of 471 freshmen students (NUMS) participated in the study, pinpointing that the data are collected in 2019 and 2020. In line with measuring depression, anxiety, and sleep quality, the Persian Beck Depression Inventory-II, Beck Anxiety Inventory, and Pittsburgh Sleep Quality Index were employed. The associations between depression and anxiety with sleep quality were assessed by using the multiple logistic regression model. All statistical analyses were conducted in STATA14, and the significant level was set at P<0.05. Results. The prevalence of depression, anxiety, and poor sleep quality in the study population was 21.4%, 31.9%, and 28%, respectively. Analytical analyses indicated that after adjusting for studied covariates, the odds of poor sleep quality in individuals with depression were 3.5 times higher compared to the counter group (P<0.001). Moreover, the odds of poor sleep quality in individuals with anxiety were 2.1 times higher compared to the counter group (P<0.001). Conclusion. Noticeable proportion of freshmen students suffer from depression and anxiety; in line with such a critical issue, our study found that depression and anxiety had a statistical association with sleep quality in study population. From this respect, it seems that providing essential interventions and psychological counseling services could be constructive for the freshmen medical students.