Context Gastrointestinal microorganisms play an important role in ruminant digestion and metabolism, immune regulation and disease prevention and control. Different parts of the digestive tract have different functions and microbial community structures. Aims This study aims to explore the microbial diversity in the rumen and the small intestine of Xinong Saanen dairy goats. Methods Rumen fluid and jejunum fluid from three Xinong Saanen dairy bucks with the average slaughter weight of 33.93 ± 0.68 kg were collected and analysed for microbial diversity, by using 16S rRNA gene high-throughput sequencing. Key results In total, 1118 operational taxonomic units (OTUs) were identified, with 1020 OTUs and 649 OTUs being clustered to rumen and jejunum samples respectively. Alpha-diversity indices were significantly (P < 0.05) different between rumen and jejunum, as indicated by the fact that the rumen microbial community diversity, richness and uniformity/evenness were higher than those of jejunum. At the phylum level, the dominant phyla in the rumen were Bacteroidetes (66.7%) and Firmicutes (25.1%), accounting for 91.8% of the rumen microorganisms. The dominant phylum in the jejunum was Firmicutes, accounting for 73.0% of the jejunum microorganisms. At the genus level, the dominant bacteria in the rumen were Prevotella_1, norank_f_Bacteroidales_BS11_gut_group, Rikenellaceae_RC9_gut_group, Christensenellaceae_R-7_group and Family_XIII_AD3011_group, whereas the dominant bacteria in the jejunum were Omboutsia, Aeriscardovia, Intestinibacter, unclassified_f_Peptostreptococcaceae and unclassified_f_Bifidobacteriaceae. Clusters of Orthologous Groups (COG) and Kyoto Encyclopedia of Genes and Genomes (KEGG) results showed that the major functions of microorganisms in the rumen and jejunum were carbohydrate metabolism, amino acid metabolism, nucleotide metabolism, membrane transport and translation. Interestingly, fructose and mannose metabolism and peptidoglycan biosynthesis were abundant in the rumen, while homologous recombination and nucleotide excision repair were abundant in the jejunum. Conclusions Our study clarified the differences in microbial diversity and community structure between the rumen and the jejunum in Xinong Saanen dairy goats. Prevotella was the most predominant genus in the rumen, compared with Romboutsia, Bifidobacterium as well as Peptostreptococcaceae genera, which were the predominant genera in the jejunum. Implications In combination with the functional prediction of microorganisms and the metabolic characteristics of different parts of the digestive tract in ruminants, our findings provided information for further exploring the relationship among genes, species and functions of microorganisms and their hosts’ nutritional and physiological functions.