Mental-health-based consultations in occupational health (OH) are increasing due to ongoing changes in working life. We studied the self-assessed mental health competence of trainees and trainers in OH specialist physician training. We conducted an online survey from June to August 2022. We analysed how trainees and trainers in OH assessed their own competence in mental health practice with N (%) and means (standard deviation [SD]). We analysed the underlying assumptions about competences specific to OH using an explanatory factor analysis. We applied the Kruskal-Wallis test to determine differences between trainees and trainers using the variables in the factor analysis. Respondents' perceptions of mental health competence were more positive among trainers (mean 3.97, SD 0.72) than trainees (mean 3.66, SD 1.08, P = 0.2123). Based on trainee physicians' own assessments, more experience increases competence, until after 7 years, when the perceived competence seems to decrease. The trainer physicians' self-assessed mental health competence decreased over time. With factor analyses, we identified five competence factors: general mental health, workplace risks and resources, rehabilitation, promotion and prevention, and special skills. In our results, individual-level mental health competences such as work ability evaluation and to manage return-to-work processes were evaluated better than community-based proactive processes. Physicians in OH specialist physician training self-assessed their mental health competence better at the employee level than at the workplace level. Based on our results, we need to develop the curriculum of OH specialist physician training to meet the needs of working life in support of mental health.