Adolescence represents an important period for the development of executive functions, which are a set of important cognitive processes including attentional control. However, very little is known regarding the associations of nutrition with components of executive functions in adolescence. Thus, the aim of this study was to investigate associations of dietary patterns and macronutrient composition with attention capacity in European adolescents. This cross-sectional study included 384 (165 boys and 219 girls) adolescents, aged 12·5–17·5 years, from five European countries in the Healthy Lifestyle in Europe by Nutrition in Adolescence study. Attention capacity was examined using the d2 Test of Attention. Dietary intake was assessed through two non-consecutive 24 h recalls using a computer-based self-administered tool. Three dietary patterns (diet quality index, ideal diet score and Mediterranean diet score) and macronutrient/fibre intakes were calculated. Linear regression analysis was conducted adjusting for age, sex, BMI, maternal education, family affluence scale, study centre and energy intake (only for Mediterranean diet score). In these adjusted regression analyses, higher diet quality index for adolescents and ideal diet score were associated with a higher attention capacity (standardised β=0·16, P=0·002 and β=0·15, P=0·005, respectively). Conversely, Mediterranean diet score or macronutrient/fibre intake were not associated with attention capacity (P>0·05). Our results suggest that healthier dietary patterns, as indicated by higher diet quality index and ideal diet score, were associated with attention capacity in adolescence. Intervention studies investigating a causal relationship between diet quality and attention are warranted.