Fertilization may impact ecosystem processes that sustain agriculture, such as nutrient cycling, by altering the composition of soil microbial communities that regulate such processes. These processes are crucial to low‐input, smallholder tropical agriculture, which supports 900 million of the world's poorest people. Yet little is known about how efforts to increase crop yield on such farms will affect the capacity of soil microbial communities to carry out ecosystem processes. We studied the diversity and functional capacity of microbial communities on smallholder farms in western Kenya. We measured functional capacity as the abundance of functional genes involved in several components of nutrient cycling as well as catabolism of multiple carbon substrates; taxonomic diversity was measured using metagenomic sequencing. Diversity and functional capacity were measured on short‐term, experimental mineral fertilizer addition plots and on actively managed farms that have maintained for at least seven years a management strategy of low mineral fertilization, high mineral fertilization, or high fertilization combined with legume rotations. Soil bacterial diversity decreased with mineral fertilizer addition, with a community shift towards taxa that thrive in high‐resource conditions. This taxonomic response did not correspond with decreased microbial functional capacity. Instead, functional capacity was increased, along with yields, when fertilizers were combined with legume rotations that add organic matter to soil. Policy implications. Mineral fertilizer use is associated with lower soil microbial diversity on smallholder farms, but not associated with changes in microbial functional capacity. Functional capacity is highest, along with yields, when mineral fertilizers are paired with legume rotations. Our findings suggest that this type of agroforestry can be an important strategy for maintaining the long‐term functional capacity of soil microbes as well as increasing crop yields on smallholder farms. These observations support proposals to achieve long‐term food production targets in sub‐Saharan Africa by combining mineral fertilizers with organic inputs.