Several studies have found associations between microbial infections during pregnancy and preterm delivery (PTD). We investigated the influence of food with antimicrobial and prebiotic components on the risk of spontaneous PTD. A literature search identified microbes associated with spontaneous PTD. Subsequently, 2 main food types (alliums and dried fruits) were identified to contain antimicrobial components that affect the microbes associated with spontaneous PTD; they also contained dietary fibers recognized as prebiotics. We investigated intake in 18,888 women in the Norwegian Mother and Child Cohort (MoBa), of whom 950 (5%) underwent spontaneous PTD (<37 gestational weeks). Alliums (garlic, onion, leek, and spring onion) [OR: 0.82 (95% CI: 0.72, 0.94), P = 0.005] and dried fruits (raisins, apricots, prunes, figs, and dates) [OR: 0.82 (95% CI: 0.72, 0.94); P = 0.005] were associated with a decreased risk of spontaneous PTD. Intake of alliums was related to a more pronounced risk reduction in early spontaneous PTD (gestational weeks 28-31) [OR: 0.39 (95% CI: 0.19, 0.80)]. The strongest association in this group was with garlic [OR: 0.47 (95% CI: 0.25-0.89)], followed by cooked onions. Intake of dried fruits showed an association with preterm prelabor rupture of membranes (PPROM) [OR: 0.74 (95% CI: 0.65, 0.95)]; the strongest association in this group was with raisins [OR: 0.71 (95% CI: 0.56, 0.92)]. The strongest association with PPROM in the allium group was with garlic [OR: 0.74 (95% CI: 0.56, 0.97)]. In conclusion, intake of food with antimicrobial and prebiotic compounds may be of importance to reduce the risk of spontaneous PTD. In particular, garlic was associated with overall lower risk of spontaneous PTD. Dried fruits, especially raisins, were associated with reduced risk of PPROM.