The Red Queen hypothesis (RQH) predicts that parasite-mediated selection will maintain sexual individuals in the face of competition from asexual lineages. The prediction is that sexual individuals will be difficult targets for coevolving parasites if they give rise to more genetically diverse offspring than asexual lineages. However, increasing host genetic diversity is known to suppress parasite spread, which could provide a short-term advantage to clonal lineages and lead to the extinction of sex. We test these ideas using a stochastic individual-based model. We find that if parasites are readily transmissible, then sex is most likely to be maintained when host diversity is high, in agreement with the RQH. If transmission rates are lower, however, we find that sexual populations are most likely to persist for intermediate levels of diversity. Our findings thus highlight the importance of genetic diversity and its impact on epidemiological dynamics for the maintenance of sex by parasites.