IntroductionThe risk of ketosis is assessed by monitoring changes in plasma metabolites and cow behavior during the peripartum period. However, little is known about changes in the fecal bile acid and microbiota of cows before parturition. Therefore, this study clarified the bile acid profile and screened potential warning biomarkers in heifers 7 days before calving.MethodsNinety healthy cows were tracked in the transition period, and plasma and feces were collected 7 days before calving, on calving day, and 7 days after calving. The cows were divided into ketosis and healthy groups based on the blood β-hydroxybutyric acid levels from day 7 after calving. The levels of serum biochemical indices were measured at three time points using commercial kits. Ten cows in the ketosis group (KET-7) and 10 healthy cows (HEA-7) were randomly selected 7 days before calving for metabolome and 16S rRNA amplicon sequencing.ResultsNo significant differences in serum energy-related indices were observed 7 days before calving. The major bile acids in the feces of the KET-7 group were non-conjugated secondary bile acids (UnconSBA). Differential bile acids were primarily derived from UnconSBA. The potential ketosis warning metabolite in feces for 7 days before delivery was isodeoxycholic acid. The abundance of Rikenellaaceae-RC9-gut-group in the KET-7 group increased, whereas the abundance of Oscillospiraceae UCG-010 bacteria significantly decreased. Lactobacillus and Prevotella-9 in feces were potential warning biomarkers for ketosis in dairy cows 7 days before calving. The variation in differential bile acids in the plasma, consistent with the feces, was mainly derived from UnconSBA. Lithocholic acid in the plasma was a potential ketosis warning metabolite 7 days before delivery.ConclusionKetotic cows experienced bile acid metabolism disorders 7 days before calving, and the gut microbiota was closely related to bile acid metabolism disorders. Future studies should investigate the relationship between secondary bile acids and the development of ketosis.