Research into the effect of nutrition on attention-deficit hyperactivity disorder (ADHD) in children has shown that the few-foods diet (FFD) substantially decreases ADHD symptoms in 60% of children. However, the underlying mechanism is unknown. In this open-label nutritional intervention study we investigated whether behavioural changes after following an FFD are associated with changes in brain function during inhibitory control in 79 boys with ADHD, aged 8–10 years. Parents completed the ADHD Rating Scale before (t1) and after the FFD (t2). Functional magnetic resonance imaging (fMRI) scans were acquired during a stop-signal task at t1 and t2, and initial subject-level analyses were done blinded for ARS scores. Fifty (63%) participants were diet responders, showing a decrease of ADHD symptoms of at least 40%. Fifty-three children had fMRI scans of sufficient quality for further analysis. Region-of-interest analyses demonstrated that brain activation in regions implicated in the stop-signal task was not associated with ADHD symptom change. However, whole-brain analyses revealed a correlation between ADHD symptom decrease and increased precuneus activation (pFWE(cluster) = 0.015 for StopSuccess > Go trials and pFWE(cluster) < 0.001 for StopSuccess > StopFail trials). These results provide evidence for a neurocognitive mechanism underlying the efficacy of a few-foods diet in children with ADHD.