Food allergy is an important health problem that affects human quality of life and socioeconomic development, and its treatment requires improvement. Intestinal flora dysbiosis is closely associated with food allergies. Asensitised mouse model was established by the intraperitoneal injection of ovalbumin (OVA). The mice were randomly divided into four groups: control, model, high-dose (H), and low-dose (L) inulin. The mice were administered water containing different concentrations of inulin four weeks before the OVA injection. Body weight changes were monitored. After the last OVA injection, the mice were scored for allergic reactions. The levels of total immunoglobulin E (IgE) and diamine oxidase (DAO) in the serum and secretory IgA (sIgA) in the small intestinal mucus were measured, and 16S rRNA sequencing of the faecal flora was performed to evaluate microbial parameters. The intestinal flora biomarkers, correlations between them, and biochemical indicators were analysed. Inulin treatment had no effect on the body weight of OVA-sensitised mice but attenuated allergic reactions and intestinal injury in mice. Compared with the control group, the model group had significantly higher levels of serum DAO and IgE and significantly lower levels of intestinal mucus IgA. IgA levels in the intestinal mucus of mice treated with inulin prior to OVA sensitisation were higher than those in non-inulin-treated OVA-sensitised mice. Furthermore, analysis of operational taxonomic units showed that inulin treatment decreased the abundance of Alloprevotella, Rikenellaceae RC9, Eubacterium siraeum, and Eubacterium xylanophilum, and increased the abundance of Blautia and Lachnospiraceae. Serum DAO levels were positively associated with Eubacterium siraeum, Alloprevotella, Eubacterium xylanophilum, and Odoribacter and negatively associated with Blautia, Tyzzerella, Alistipes, Desulfovibrionaceae, and Ruminococcaceae UCG005. In addition, IgE levels were positively associated with Eubacterium siraeum, Alloprevotella, Eubacterium xylanophilum, Odoribacter, and Citrobacter and negatively associated with Blautia, unclassified Ruminococcaceae, and Alistipes. IgA exhibited significant positive correlation with Blautia, norank_f_Eubacterium coprostanoligenes, Alistipes, norank Desulfovibrionaceae, Muribaculum, and Ruminococcaceae U C G 005 and significant negative correlation with Eubacterim siraeum, Eubacterium xylanophilum, Odoribacter, and Citrobacter. Inulin exerts a protective effect against food allergies in mice, which is partially mediated by alterations in the gut microbiota.