Purpose: To present the prevalence of medicine use for headache in a nationally representative sample of adolescents in Denmark, and to examine the association between poor mental health, frequent headache, and medicine use for headache. Our hypothesis was that poor mental health increases the risk of headache which triggers medicine use for headache. Methods: The Danish arm of the 2022 Health Behaviour in School-aged Children (HBSC) study included 5,767 11-, 13- and 15-year-old students with self-reported data about headache frequency, medicine use for headache, and five indicators of mental health: Life satisfaction, emotional symptoms, loneliness, self-efficacy, and self-esteem. We used multivariate logistic regression analyses to examine whether the indicators of mental health were associated with medicine use for headache and whether inclusion of headache frequency in the statistical models changed the associations. Results: The prevalence of headache at least weekly was 32.7%. In the last month, 42.7% had used medicine for headache. Students with poor mental health had significantly higher rates of headache and significantly higher rates of medicine use for headache. For example, the OR (95% CI) for medicine use for headache was 2.27 (1.90-2.72) among students with low life satisfaction. When headache frequency was included in the statistical models, the associations between poor mental health and medicine use for headache attenuated and became insignificant. For example, the OR for medicine use for headache attenuated to 1.18 (0.96-1.41) among students with low life satisfaction. Conclusions: Poor mental health was associated with medicine use for headache. Poor mental health was also associated with frequent headache. The analyses suggest that frequent headache may be the explanatory factor behind the association between poor mental health and medicine use for headache. There is a need for promotion of rational medicine use among adolescents and mental health promotion may contribute to this effort.