IMPORTANCE Gut dysbiosis impairs response to immune checkpoint inhibitors (ICIs) and can be caused by broad-spectrum antibiotic (ATB) therapy. OBJECTIVE To evaluate whether there is an association between ATB therapy administered concurrently (cATB) or prior (pATB) to ICI therapy and overall survival (OS) and treatment response to ICI therapy in patients with cancer treated with ICIs in routine clinical practice. DESIGN, SETTING, AND PARTICIPANTS This prospective, multicenter, cohort study conducted at 2 tertiary academic referral centers recruited 196 patients with cancer who received ICI therapy between January 1, 2015, and April 1, 2018, in routine clinical practice rather than clinical trials.MAIN OUTCOMES AND MEASURES Overall survival calculated from the time of ICI therapy commencement and radiologic response to ICI treatment defined using the Response Evaluation Criteria in Solid Tumors (version 1.1), with disease refractory to ICI therapy defined as progressive disease 6 to 8 weeks after the first ICI dose without evidence of pseudoprogression. RESULTS Among 196 patients (137 men and 59 women; median [range] age, 68 [27-93] years) with non-small cell lung cancer (n = 119), melanoma (n = 38), and other tumor types (n = 39), pATB therapy (HR, 7.4; 95% CI, 4.3-12.8; P < .001), but not cATB therapy (HR, 0.9; 95% CI, 0.5-1.4; P = .76), was associated with worse OS (2 vs 26 months for pATB therapy vs no pATB therapy, respectively) (hazard ratio [HR], 7.4; 95% CI, 4.2-12.9) and a higher likelihood of primary disease refractory to ICI therapy (21 of 26 [81%] vs 66 of 151 [44%], P < .001). Overall survival in patients with non-small cell lung cancer (2.5 vs 26 months, P < .001), melanoma (3.9 vs 14 months, P < .001), and other tumor types (1.1 vs 11, P < .001) was consistently worse in those who received pATBs vs those who did not. Multivariate analyses confirmed that pATB therapy (HR, 3.4; 95% CI, 1.9-6.1; P < .001) and response to ICI therapy (HR, 8.2; 95% CI, 4.0-16.9; P < .001) were associated with OS independent of tumor site, disease burden, and performance status.CONCLUSIONS AND RELEVANCE Despite being limited by sample size, geographic origin, and the lack of correlative analyses on patients' gut microbiota, this study suggests that pATB therapy but not cATB therapy is associated with a worse treatment response and OS in unselected patients treated with ICIs in routine clinical practice. Mechanistic studies are urgently required to investigate ATB-mediated alterations of gut microbiota as a determinant of poorer outcome following ICI treatment.