Zanthoxylum bungeanum essential oil (EOZB) as an extract of Zanthoxylum bungeanum has a range of pharmacological effects such as antibacterial, anti-inflammatory, and antioxidant. However, there were no relevant studies on the regulation of gut microbes by EOZB in ruminants. In this study, the effects of different doses of EOZB on the structure and distribution of microorganisms in the small intestine of small-tailed Han sheep (STH) were investigated by 16s rRNA gene sequencing technique. We found that with the intervention of EOZB. The differential bacteria of duodenal at the phylum level were Firmicutes, Bacteroidetes, Tenericutes and Proteobacteria, and genus level differential bacteria were Prevotella 1, Ruminococcus 2 and Eubacterium coprostanoligenes group. The differential bacteria of jejunal at the phylum level were Firmicutes, Bacteroidetes, Tenericutes and Proteobacteria, and genus level differential bacteria were Prevotella 1, Rikenellaceae RC9 gut group, Christensenellaceae R-7 group, Ruminococcaceae UCG-014, Saccharofermentans, Ruminococcaceae NK4A214 group and Prevotellaceae UCG-001. The differential bacteria of ileal at the phylum level were Firmicutes, Bacteroidetes and Tenericutes, and genus level differential bacteria were Prevotella 1, Christensenellaceae R-7 group, Romboutsia and Ruminococcaceae UCG-014. In addition, at the same dose of EOZB, the five most abundant genera of bacteria varied in different regions of the small intestine. Among them, the abundance of Prevotella 1, Christensenellacea R-7 group and Ruminococcus 2 in ALW group was the highest in jejunum, duodenum and ileum, respectively. The abundance of Prevotella 1, Christensenellacea R-7 group and Rikenellacea RC9 gut group in BLW group was the highest in duodenum, jejunum and ileum, respectively. The abundance of Prevotella 1, Christensenellacea R-7 group and Ruminococcaeae NK4A214 group in CLW group was the highest in jejunum, duodenum and ileum, respectively. The abundance of Prevotella 1, Ruminococcus 2 and Ruminococcus NK4A214 groups in DLW group was the highest in jejunum, duodenum and ileum, respectively. Differential bacteria formed under the regulation of EOZB are associated with the digestion and absorption of nutrients and the state of intestinal health in the host. This study is the first to investigate the effect of EOZB on the distribution and structure of bacteria in the small intestine of STH. The results of the study enriched the structure and distribution of bacteria in the small intestine of ruminants and provided new insights into the future application of herbal medicine in ruminant production. Additionally, it provides a theoretical basis for the selection of probiotic bacteria for ruminants and the development and application of microecological preparations.