Plant pathogenic bacteria cause high crop and economic losses to human societies1-3. Infections by such pathogens are challenging to control as they often arise through complex interactions between plants, pathogens and the plant microbiome4,5. Experimental studies of this natural ecosystem at the microbiome-wide scale are rare, and consequently we have a poor understanding of how the taxonomic and functional microbiome composition and the resulting ecological interactions affect pathogen growth and disease outbreak. Here, we combine DNA-based soil microbiome analysis with in vitro and in planta bioassays to show that competition for iron via secreted siderophore molecules is a good predictor of microbe-pathogen interactions and plant protection. We examined the ability of 2,150 individual bacterial members of 80 rhizosphere microbiomes, covering all major phylogenetic lineages, to suppress the bacterium Ralstonia solanacearum, a global phytopathogen capable of infecting various crops6,7. We found that secreted siderophores altered microbiome-pathogen interactions from complete pathogen suppression to strong facilitation. Rhizosphere microbiome members with growth-inhibitory siderophores could often suppress the pathogen in vitro as well as in natural and greenhouse soils, and protect tomato plants from infection. Conversely, rhizosphere microbiome members with growth-promotive siderophores were often inferior in competition and facilitated plant infection by the pathogen. Because siderophores are a chemically diverse group of molecules, with each siderophore type relying on a compatible receptor for iron uptake8-12, our results suggest that pathogen-suppressive microbiome members produce siderophores that the pathogen cannot use. Our study establishes a causal mechanistic link between microbiome-level competition for iron and plant protection and opens promising avenues to use siderophore-mediated interactions as a tool for microbiome engineering and pathogen control.