In East Africa, up to four symbiotic ant species associate with the obligate myrmecophyte Acacia drepanolobium. These ant species differ in the extent to which they defend their host trees from both vertebrate and invertebrate herbivores, but other potential roles of ants in tree defense have not been studied. We investigate the distribution of a new species of parasitic midge targeting A. drepanolobium in a region where A. drepanolobium is inhabited almost exclusively by two ant species—Crematogaster nigriceps and C. mimosae. We find that the frequency of infestation correlates strongly with the identity of the ant occupant: trees inhabited by C. nigriceps are significantly less likely to be infested with parasitic midges. Although the two ant species responded similarly to simulated large herbivore disturbances, trees inhabited by C. nigriceps also had a lower invertebrate load than trees inhabited by C. mimosae. We suggest that differences in defensive behavior towards invertebrates could be one explanation of the observed differences in infestation of A. drepanolobium by parasitic midges.