In response to environmental stimuli, immune memory mediates the plasticity of myeloid cells. Immune training and immune tolerance are two aspects of plasticity. Microglia that are immunologically trained or immunologically tolerant are endowed with a tendency to differentiate into alternative dominant phenotypes (M1/M2). Male C57BL/6 mice (immune-training group, immune-tolerant group, and control group) were used to establish the kainic acid epilepsy model. The seizure grade, duration, latency, hippocampal potential, and energy density were used to evaluate seizures, and the changes in the polarization of microglia were detected by western blot. 16S rDNA sequencing showed that the abundance of Ruminococcus in the immune-tolerant group was the dominant flora. Our research connections Intestinal microorganisms, brain immune status, and epilepsy behavior together. Pro-inflammatory M1 phenotype and anti-inflammatory M2 phenotype mediate and enhance and suppress subsequent inflammation, respectively. We conclude that intestinal microorganisms influence the occurrence and development of epilepsy by regulating the polarization of microglia.