Synthetic glucocorticoids, to enhance fetal maturation, are a standard treatment when preterm birth before 34 gestational weeks is imminent. While morbidity- and mortality-related benefits may outweigh potential neurodevelopmental harms in children born preterm (<37 gestational weeks), this may not hold true when pregnancy continues to term (⩾37 gestational weeks). We studied the association of antenatal betamethasone exposure on child mental health in preterm and term children. We included 4708 women and their children, born 2006-2010, from the Prediction and Prevention of Pre-eclampsia and Intrauterine Growth Restriction Study with information on both antenatal betamethasone treatment and child mental and behavioral disorders from the Finnish Hospital Discharge Register from the child's birth to 31 December 2016. Additional follow-up data on mother-reported psychiatric problems and developmental milestones were available for 2640 children at 3.5 (s.d. = 0.07) years-of-age. Of the children, 187 were born preterm (61 betamethasone-exposed) and 4521 at term (56 betamethasone-exposed). The prevalence of any mental and behavioral, psychological development, emotional and behavioral, and comorbid disorders was higher in the betamethasone-exposed, compared to non-exposed children [odds ratio 2.76 (95% confidence interval 1.76-4.32), 3.61 (2.19-5.95), 3.29 (1.86-5.82), and 6.04 (3.25-11.27), respectively]. Levels of psychiatric problems and prevalence of failure to meet the age-appropriate development in personal-social skills were also higher in mother-reports of betamethasone-exposed children. These associations did not vary significantly between preterm and term children. Antenatal betamethasone exposure may be associated with mental health problems in children born preterm and in those who end up being born at term.