Abstract Resource competition and metabolic cross-feeding are among the main drivers of microbial community assembly. Yet, the degree to which these two conflicting forces are reflected in the composition of natural communities has not been systematically investigated. Here, we use genome-scale metabolic modeling to assess resource competition and metabolic cooperation potential in large co-occurring groups, with up to 40 member species, across thousands of habitats. Our analysis revealed two distinct community types, clustering at opposite ends in a trade-off landscape between competition and cooperation. On one end lie highly cooperative communities, characterized by smaller genomes and multiple auxotrophies, reminiscent of the black queen hypothesis. At the other end lie highly competitive communities, conforming to the red queen hypothesis, featuring larger genomes and overlapping nutritional requirements. While the latter are mainly present in soils, the former are found both in free-living and host-associated habitats. Community-scale flux simulations showed that, while the competitive communities can better resist species invasion but not nutrient shift, the cooperative communities are susceptible to species invasion but resilient to nutrient change. In accord, we show, through analyzing an additional independent dataset, the colonization of the human gut by probiotic species is positively associated with the presence of cooperative species in the recipient microbiome. Together, our analysis highlights the bifurcation between competition and cooperation in the assembly of natural communities and its implications for community modulation.