Gut microbiota dysbiosis plays an important role in the progression of non-alcoholic fatty liver disease (NAFLD), and no approved drugs are available for NAFLD treatment. In this study, we aimed to explore the dynamic changes of gut microbiota at the different stages of NAFLD and determine whether ursodeoxycholic acid (UDCA) could improve liver histopathological features of non-alcoholic steatohepatitis (NASH) mice induced by a high-fat high-cholesterol (HFHC) diet and its impact on gut microbiota. 6-week-old male C57BL/6 mice were fed with a HFHC or normal diet for 12, 18, and 24 weeks, respectively, to simulate the different stages of NAFLD. 16s ribosomal RNA genes from mice fecal samples at the different time points were sequenced to evaluate the dynamic changes of the gut microbiota. Then, C57BL/6 mice were fed with a HFHC diet for 24 weeks to establish the NASH model. Different doses of UDCA were administered intragastrically for additional 4 weeks. Normal diet–fed mice were taken as control. Serum samples, liver, and intestine tissues were harvested for biochemical tests and histopathological examinations. 16s ribosomal RNA genes from mice fecal samples were sequenced to assess the structural changes of gut microbiota. HFHC diet–fed mice developed simple steatosis, steatohepatitis, and fibrosis at 12, 18, and 24 weeks, respectively. The profile of gut microbiota dynamically changed with the different stages of NAFLD. NASH mice had significantly higher abundance of Fecalibaculum, Coriobacteriaceae_UCG-002, and Enterorhabdus, and lower abundance of norank_f_Muribaculaceae, Bacteroides, and Alistipes, which were partially restored by UDCA treatment. UDCA treatment significantly attenuated hepatic inflammation of NASH mice as indicated by the sum of ballooning and lobular inflammation of the NALFD activity score (3.2 ± 0.8 vs 1.8 ± 0.8, p = 0.029), and partially restored gut microbiota dysbiosis, and increased the expression of Claudin-1 and ZO-1 in the intestine, but did not activate the suppressed Farnesoid X receptor signal pathway. Conclusions: The gut microbiota dynamically changes with the different stages of NAFLD. UDCA treatment (120 mg/kg) could partially restore gut microbiota, repair gut barrier integrity, and attenuate hepatic inflammation in the NASH mouse model.