Background. Attention Deficit Hyperactivity Disorder (ADHD) is a prevalent neurodevelopmental disorder. Effective long-term treatment options are limited, which warrants increased focus on potential modifiable risk factors. The aim of this study was to investigate associations between maternal diet quality during pregnancy and child diet quality and child ADHD symptoms and ADHD diagnosis. Methods. This study is based on the Norwegian Mother, Father and Child Cohort Study (MoBa). We assessed maternal diet quality with the Prenatal Diet Quality Index (PDQI) and Ultra-Processed Food Index (UPFI) around mid-gestation, and child diet quality using the Diet Quality Index (CDQI) at 3 years. ADHD symptoms were assessed at child age 8 years using the Parent Rating Scale for Disruptive Behaviour Disorders. ADHD diagnoses were retrieved from the Norwegian Patient Registry. Results. In total, 77,768 mother-child pairs were eligible for studying ADHD diagnoses and 37,787 for ADHD symptoms. Means (SD) for the PDQI, UPFI and CDQI were 83.1 (9.3), 31.8 (9.7) and 60.3 (10.6), respectively. Mean (SD) ADHD symptom score was 8.4 (7.1) and ADHD diagnosis prevalence was 2.9% (male to female ratio 2.6.1). For one SD increase in maternal diet index scores, we saw a change in mean (percent) ADHD symptom score of − 0.28 (− 3.3%) (CI. − 0.41, − 0.14 (− 4.8, − 1.6%)) for PDQI scores and 0.25 (+ 3.0%) (CI. 0.13, 0.38 (1.5, 4.5%)) for UPFI scores. A one SD increase in PDQI score was associated with a relative risk of ADHD diagnosis of 0.87 (CI. 0.79, 0.97). We found no reliable associations with either outcomes for the CDQI, and no reliable change in risk of ADHD diagnosis for the UPFI. Conclusions. We provide evidence that overall maternal diet quality during pregnancy is associated with a small decrease in ADHD symptom score at 8 years and lower risk for ADHD diagnosis, with more robust findings for the latter outcome. Consumption of ultra-processed foods was only associated with increased ADHD symptom score of similar magnitude as for overall maternal diet quality, and we found no associations between child diet quality and either outcome. No causal inferences should be made based on these results, due to potential unmeasured confounding.