We examined cross-sectional and longitudinal associations of dietary factors with caries experience in a population sample of 487 children aged 6–9 years at baseline examinations of the Physical Activity and Nutrition in Children (PANIC) Study. Altogether, 406 of these children attended 2-year follow-up examinations. Food consumption and eating frequency were assessed using 4-day food records, diet quality using the Baltic Sea Diet Score (BSDS) and eating behaviour using the Children’s Eating Behavior Questionnaire. Caries experience was examined clinically. The cross-sectional associations of dietary factors with caries experience at baseline were analysed using linear regression and the longitudinal associations of dietary factors with a change in caries experience over follow-up using generalised mixed-effects regression adjusted for other risk factors. A higher consumption of high-fibre grain products (standardised regression coefficient β = −0·16, P = 0·003) and milk (β = −0·11, P = 0·025) and higher BSDS (β = −0·15, P = 0·007) were associated with lower caries experience, whereas a higher consumption of potatoes (β = 0·11, P = 0·048) and emotional overeating (β = 0·12, P = 0·025) were associated with higher caries experience. Higher snacking frequency (fixed coefficient β = 0·07, P = 0·033), desire to drink (β = 0·10, P = 0·046), slowness in eating (β = 0·12, P = 0·027) and food fussiness (β = 0·12, P = 0·018) were associated with higher caries experience, whereas enjoyment of food (β = −0·12, P = 0·034) and higher BSDS (β = −0·02, P = 0·051) were associated with lower caries experience.