Genetic variants associated with dietary intake may be important as factors underlying the development of obesity. We investigated the associations between the obesity candidate genes (fat mass and obesity-associated (FTO), melanocortin-4 receptor (MC4R), leptin (LEP) and leptin receptor) and total energy intake and percentage of energy from macronutrients and ultra-processed foods before and during pregnancy. A sample of 149 pregnant women was followed up in a prospective cohort in Rio de Janeiro, Brazil. A FFQ was administered at 5–13 and 30–36 weeks of gestation. Genotyping was performed using real-time PCR. Associations between polymorphisms and the outcomes were investigated through multiple linear regression and ANCOVA having pre-pregnancy dietary intake as a covariate. The A-allele of FTO-rs9939609 was associated with a −6·5 % (95 % CI −12·3, −0·4) decrease in the percentage of energy from protein and positively associated with the percentage of energy from carbohydrates before pregnancy (β=2·6; 95 % CI 0·5, 4·8) and with a 13·3 % (95 % CI 0·7, 27·5) increase in the total energy intake during pregnancy. The C-allele of MC4R-rs17782313 was associated with a −7·6 % (95 % CI −13·8, −1·0) decrease in the percentage of energy from protein, and positively associated with the percentage of energy from ultra-processed foods (β=5·4; 95 % CI 1·1, 9·8) during pregnancy. ANCOVA results revealed changes in dietary intake from pre-pregnancy to pregnancy for FTO-rs9939609 (percentage of energy from ultra-processed foods, P=0·03), MC4R-rs17782313 (total energy intake, P=0·02) and LEP-rs7799039 (total energy intake, P=0·04; percentage of energy from protein, P=0·04). These findings suggest significant associations between FTO-rs9939609, MC4R-rs17782313 and LEP-rs7799039 genes and the components of dietary intake in pregnant women.