Objective:To investigate the cross-sectional associations of dietary carbohydrate and fatty acid intakes with cognition in mid-childhood.Design:Dietary carbohydrate and fatty acid intakes were assessed using 4-d food records, and cognition was evaluated using the Raven’s Coloured Progressive Matrices (RCPM) score. The cross-sectional associations of dietary carbohydrate and fatty acid intakes with cognition were investigated using linear regression analyses adjusted for age, sex, body fat percentage, household income, parental education and daily energy intake.Setting:The baseline examinations of the Physical Activity and Nutrition in Children study.Participants:A population-based sample of 487 children (250 boys, 237 girls) aged 6–8 years living in the city of Kuopio, Finland.Results:A higher dietary intake of fructose (standardised regression coefficient, β = 0·24, P < 0·001), total fibre (β = 0·16, P = 0·02) and soluble fibre (β = 0·15, P = 0·02) was associated with a higher RCPM score in boys. Other dietary carbohydrates and fatty acids, including total carbohydrates, glucose, sucrose, starch, insoluble fibre, total fat, SFAs, MUFAs, PUFAs, palmitic acid (C16), stearic acid (C18), linoleic acid (C18:2), α-linoleic acid (C18:3), arachidonic acid (C20:4), EPA (C20:5n-3) and DHA (C22:6n-6), were not associated with the RCPM score in boys. Dietary carbohydrates or fatty acids were not associated with the RCPM score in girls.Conclusions:Higher dietary fructose and fibre intakes were associated with better cognition in boys, but not in girls. Dietary fatty acids were not related to cognition in boys or in girls.