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. We found that the abundance of arbuscular mycorrhizal fungi and Streptomyces bacteria increased when soil microbes were inoculated, and such increase was more significant at lower plant diversity, potentially explaining the effects of soil inoculation on plant productivity. These results suggest that the belowground plant beneficial microbes can counteract the effect of aboveground plant pathogens in mediating positive plant diversity-productivity relationships. 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.