Rationale Childhood asthma is often preceded by recurrent episodes of asthma-like symptoms, which can be triggered by both viral and bacterial agents. Recent randomized controlled trials have shown that azithromycin treatment reduces episode duration and severity through yet undefined mechanisms. Objectives Here, we studied the influence of the airway microbiota on the effect of azithromycin treatment during acute episodes of asthma-like symptoms. Methods Children from the Copenhagen Studies on Asthma in Childhood 2010 (COPSAC2010) cohort with recurrent asthma-like symptoms aged 12-36 months were randomized during acute episodes to azithromycin or placebo as previously reported. Prior to randomization, hypopharyngeal aspirates were collected and examined by 16S rRNA gene amplicon sequencing. Measurements and Main Results In 139 airway samples from 68 children, episode duration after randomization was associated with microbiota richness (7.5% increased duration per 10 additional Operational Taxonomic Units (OTUs), 95% confidence interval [1%;14%], p=0.025), with 15 individual OTUs (including several Neisseria and Veillonella), and with microbial pneumotypes defined from weighted UniFrac distances (longest durations in a Neisseria-dominated pneumotype). Microbiota richness before treatment increased the effect of azithromycin by 10% per 10 additional OTUs, and more OTUs were positively vs. negatively associated with increased azithromycin effect (82 vs. 58, p=0.0032). Furthermore, effect modification of azithromycin was found for 5 individual OTUs (3 increased and 2 decreased the effect, q<0.05). Conclusions The airway microbiota in acute episodes of asthma-like symptoms is associated with episode duration and modifies the effect of azithromycin treatment of the episodes in preschool children with recurrent asthma-like symptoms. Clinical trial registration available at www.clinicaltrials.gov, ID: NCT01233297.