BackgroundCystic Fibrosis (CF) is a genetic condition characterized by neutrophilic inflammation and recurrent infection of the airways. How these processes are initiated and perpetuated in CF remains largely unknown. We have demonstrated a link between the intestinal microbiota-related metabolites bile acids (BA) and inflammation in the bronchoalveolar lavage fluid (BALF) from children with stable CF lung disease. To establish if BA indicate early pathological processes in CF lung disease, we combined targeted mass spectrometry and amplicon sequencing-based microbial characterization of 121 BALF specimens collected from 12-month old infants with CF enrolled in the COMBAT-CF study, a multicentre randomized placebo-controlled clinical trial comparing azithromycin versus placebo. We evaluated whether detection of BA in BALF is associated with the establishment of the inflammatory and microbial landscape of early CF lung disease, and whether azithromycin, a motilin agonist that has been demonstrated to reduce aspiration of gastric contents, alters the odds of detecting BA in BALF. We also explored how different prophylactic antibiotics regimens impact the early life BALF microbiota.ResultsDetection of BA in BALF was strongly associated with biomarkers of airway inflammation, more exacerbation episodes during the first year of life, increased use of oral antibiotics with prolonged treatment periods, a higher degree of structural lung damage, and distinct microbial profiles. Treatment with azithromycin, a motilin agonist, which has been reported to reduce aspiration of gastric contents, did not reduce the odds of detecting BA in BALF. Culture and molecular methods showed that azithromycin does not alter bacterial load or diversity in BALF. Conversely, penicillin-type prophylaxis reduced the odds of detecting BAs in BALF, which was associated with elevated levels of circulating biomarkers of cholestasis. We also observed that environmental factors such as penicillin-type prophylaxis or BAs detection were linked to distinct early microbial communities of the CF airways, which were associated with different inflammatory landscapes but not with structural lung damage.ConclusionsDetection of BA in BALF portend early pathological events in CF lung disease. Benefits early in life associated with azithromycin are not linked to its antimicrobial properties.Video AbstractSupplementary InformationThe online version contains supplementary material available at 10.1186/s40168-023-01543-9.