BACKGROUND: This paper examines socioeconomic inequalities in mental health at school entry and explores changes in these inequalities over the first 3 years of school. METHODS: The study utilises routinely collected mental health data from education records and demographic data at ages 4 and 7 years, along with administrative school-level data. The study was set in preschool establishments and schools in Glasgow City, Scotland. Data were available on 4011 children (59.4%)at age 4 years, and 3166 of these children were followed at age 7 years (46.9% of the population). The main outcome measure was the teacher-rated Goodman’s Strengths and Difficulties Questionnaire (4-16 version) at age 7 years, which measures social, emotional and behavioural difficulties. RESULTS: Children living in the most deprived area had higher levels of mental health difficulties at age 4 years, compared with their most affluent counterparts (7.3%vs4.1% with abnormal range scores). There was a more than threefold widening of this disparity over time, so that by the age of 7 years, children from the most deprived area quintile had rates of difficulties 3.5 times higher than their more affluent peers. Children’s demographic backgrounds strongly predicted their age 7 scores, although schools appeared to make a significant contribution to mental health trajectories. CONCLUSIONS: Additional support to help children from disadvantaged backgrounds at preschool and in early primary school may help narrow inequalities. Children from disadvantaged backgrounds started school with a higher prevalence of mental health difficulties, compared with their more advantaged peers, and this disparity widened markedly over the first 3 years of school.