BackgroundThis longitudinal study classified groups of children experiencing different trajectories of student-teacher relationship quality over the transition from preschool into school, and determined the strength of the association between different student-teacher relationship trajectories and childhood mental health problems in the second year of primary school.MethodsA community sample of 460 Australian children were assessed in preschool (age 4), the first school year (age 5), and second school year (age 6). Teachers at all three assessments reported on student-teacher relationship quality with the Student Teacher Relationship Scale. When the children were at preschool and in their second school year, parents and teachers rated children’s mental health problems using the Strengths and Difficulties Questionnaire.ResultsLatent-class growth modelling identified two trajectories of student-teacher relationship quality: (1) a stable-high student-teacher relationship quality and (2) a moderate/declining student-teacher relationship quality trajectory. Generalised linear models found that after adjusting for family demographic characteristics, having a stable high quality student-teacher relationship trajectory was associated with fewer parent-rated and teacher-rated total mental health problems, and fewer conduct, hyperactivity, and peer problems, and greater prosocial behaviour at age 6. A stable high quality trajectory was also associated with fewer teacher-rated, but not parent-rated emotional symptoms. These effects remained after adjustment for levels of mental health problems at age 4.ConclusionsFindings suggest that early intervention and prevention strategies that focus on building stable high quality student-teacher relationships during preschool and children’s transition into formal schooling, may help reduce rates of childhood mental health problems during the early school years.Electronic supplementary materialThe online version of this article (doi:10.1186/s40359-014-0027-2) contains supplementary material, which is available to authorized users.