Understanding how biodiversity varies from place to place is a fundamental goal of ecology and an important tool for halting biodiversity loss. Parasitic wasps (Hymenoptera) are a diverse and functionally important animal group, but spatial variation in their diversity is poorly understood. We survey a community of parasitic wasps (Ichneumonidae: Pimplinae) using Malaise traps up a mountain in the Brazilian Atlantic Rainforest, and relate the catch to biotic and abiotic habitat characteristics. We find high species richness compared with previous similar studies, with abundance, richness, and diversity peaking at low to intermediate elevation. There is a marked change in community composition with elevation. Habitat factors strongly correlated with elevation also strongly predict changes in the pimpline community, including temperature as well as the density of bamboo, lianas, epiphytes, small trees, and herbs. These results identify several possible surrogates of pimpline communities in tropical forests, which could be used as a tool in conservation. They also contribute to the growing evidence for a typical latitudinal gradient in ichneumonid species richness, and suggest that low to medium elevations in tropical regions will sometimes conserve the greatest number of species locally, but to conserve maximal biodiversity, a wider range of elevations should also be targeted.