Plant-associated microbes play a key role in mediating the relationship between plant diversity and productivity. However, previous studies have generally focused on a sole microbial guild (i.e. plant-beneficial microbes or pathogens), and on either aboveground or belowground microbes. As a result, the interplay among different microbial guilds and the overall impact of above- and belowground microbes on plant diversity-productivity relationships have rarely been investigated. Here we carried out an experiment where we applied microbial inocula collected from leaves and soils in the field onto plant leaves and soil in a greenhouse experiment with a herbaceous plant community. We showed that microbial inoculation of leaves reduced plant productivity and this negative effect was weaker at higher plant diversity, which promoted positive diversity-productivity relationships through complementarity effects. In contrast, microbial inoculation of soil alone had no impact on plant diversity-productivity relationships, but it counteracted the negative effects of leaf inoculum on plant productivity and weakened the leaf microbe-induced positive diversity-productivity relationships. Arbuscular mycorrhizal fungi and Streptomyces bacteria were abundant in microbe-inoculated soils and there was a decreased diversity and abundance of these microbial taxa with increasing plant diversity. These results suggest that the effect of aboveground plant pathogens in mediating positive plant diversity-productivity relationships can be compensated by belowground microbes including arbuscular mycorrhizal fungi. Simultaneous study of plant-pathogenic and -beneficial microbes both above- and belowground is required to better understand the contributions of plant-associated microbes to biodiversity-ecosystem function relationships.