The aim of this study was to investigate the impact of the first year of medical school on the relationship between nutritional knowledge and sleep. To achieve this, first-year medical students at Wroclaw Medical University were invited to participate in the study during both the initial and final months of their first academic year. The study included 570 students in the initial period and 705 in the latter. The research questionnaire comprised the KomPAN, assessing nutritional knowledge, and the Pittsburgh Sleep Quality Index (PSQI), evaluating sleep quality. The majority of students demonstrated at least sufficient nutritional knowledge, while approximately two-thirds of students experienced poor sleep in both periods. Notably, sleep quality further deteriorated in the second period (PSQI total score: 6.86 vs. 7.38, p = 0.0157). This change was influenced mainly by a decrease in sleep duration and an increase in the use of sleep medications (both p < 0.0001). The significant difference in overall sleep quality between different nutritional knowledge levels emerged only in the second semester, where students with the highest nutritional knowledge slept the best, while those with the lowest slept the worst (p = 0.0001). Crucially, in both periods, the use of sleep medications was highest among individuals with insufficient nutritional knowledge. Throughout the academic year, the usage increased for all except those with the highest nutritional knowledge, who exhibited the best sleep (p < 0.0001). The escalating use of sleep medications among medical students warrants greater attention, and leveraging the relationship between nutritional knowledge and sleep could prove beneficial, as positive habits in one domain may positively influence the other.