Maternal high-fat diet intake has profound effects on the long-term health of offspring, predisposing them to a higher susceptibility to obesity and metabolic dysfunction-associated steatotic liver disease. However, the detailed mechanisms underlying the role of a maternal high-fat diet in hepatic lipid accumulation in offspring, especially at the weaning age, remain largely unclear. In this study, female C57BL/6J mice were randomly assigned to either a high-fat diet or a control diet, and lipid metabolism parameters were assessed in male offspring at weaning. Gut microbiota analysis and targeted metabolomics of short-chain fatty acids (SCFAs) in these offspring were further performed. Both in vivo and in vitro studies were conducted to explore the role of butyrate in hepatic cholesterol excretion in the liver and HepG2 cells. Our results showed that maternal high-fat feeding led to obesity and dyslipidemia, and exacerbated hepatic lipid accumulation in the livers of offspring at weaning. We observed significant decreases in the abundance of the Firmicutes phylum and the Allobaculum genus, known as producers of SCFAs, particularly butyrate, in the offspring of dams fed a high-fat diet. Additionally, maternal high-fat diet feeding markedly decreased serum butyrate levels and down-regulated ATP-binding cassette transporters G5 (ABCG5) in the liver, accompanied by decreased phosphorylated AMP-activated protein kinase (AMPK) and histone deacetylase 5 (HADC5) expressions. Subsequent in vitro studies revealed that butyrate could induce ABCG5 activation and alleviate lipid accumulation via the AMPK-pHDAC5 pathway in HepG2 cells. Moreover, knockdown of HDAC5 up-regulated ABCG5 expression and promoted cholesterol excretion in HepG2 cells. In conclusion, our study provides novel insights into how maternal high-fat diet feeding inhibits hepatic cholesterol excretion and down-regulates ABCG5 through the butyrate-AMPK-pHDAC5 pathway in offspring at weaning.