Exposure to allergic inflammation, while in utero, increased mast cell and microglia activation, leading to masculinization of dendritic spine density in the preoptic area of females. During adulthood, females exposed to allergic inflammation showed an increase in more masculine behaviors.