Background: The association between sleep patterns and young students’ mental health, which is crucial for their development, remains understudied in rural China. Therefore, the relationship between sleep patterns and mental health among primary and junior high school students in rural China was examined. Method: A total of 1592 primary and junior high school students from rural areas of Gansu Province were surveyed, and the Depression Anxiety and Stress Scale (DASS) was utilized to assess mental health, alongside self-reported data on their daily sleep patterns. Results: Significant sleep inadequacies were identified: 28% of students received less than 8 h of sleep on weekdays, and 19% went to bed later than recommended. On weekends, 38% of students had delayed bedtimes, though only 7.2% received less than 8 h of sleep. Notably, a “U-shaped” relationship was uncovered between sleep duration and mental health for students on weekends, with optimal mental health correlated with receiving 10–11 h of sleep, while both shorter and longer sleep durations on weekends worsened outcomes. This pattern is absent on weekdays. Additionally, adequate sleep and an earlier bedtime was linked to a 6–8% decrease in mental health risks. Conclusions: These findings provide valuable insights for policymakers seeking to enhance student mental well-being in rural settings, emphasizing the importance of implementing measures that promote balanced sleep habits among young students.