Males and females are subjected to distinct kinds of selection pressures, often leading to the evolution of sex‐specific genetic architecture, an example being sex‐specific dominance. Sex‐specific dominance reversals (SSDRs), where alleles at sexually antagonistic loci are at least partially dominant in the sex they benefit, have been documented in Atlantic salmon, rainbow trout, and seed beetles. Another interesting feature of many sexually reproducing organisms is the asymmetric inheritance pattern of X chromosomes, which often leads to distinct evolutionary outcomes on X chromosomes compared to autosomes. Examples include the higher efficacy of sexually concordant selection on X chromosomes, and X chromosomes being more conducive to the maintenance of sexually antagonistic polymorphisms under certain conditions. Immunocompetence is a trait that has been extensively investigated for sexual dimorphism with growing evidence for sex‐specific or sexually antagonistic variation. X chromosomes have been shown to harbor substantial immunity‐related genetic variation in the fruit fly, Drosophila melanogaster. Here, using interpopulation crosses and cytogenetic cloning, we investigated sex‐specific dominance and the role of the X chromosome in improved postinfection survivorship of laboratory populations of D. melanogaster selected against pathogenic challenge by Pseudomonas entomophila. We could not detect any contribution of the X chromosome to the evolved immunocompetence of our selected populations, as well as to within‐population variation in immunocompetence. However, we found strong evidence of sex‐specific dominance related to surviving bacterial infection. Our results indicate that alleles that confer a survival advantage to the selected populations are, on average, partially dominant in females but partially recessive in males. This could also imply an SSDR for overall fitness, given the putative evidence for sexually antagonistic selection affecting immunocompetence in Drosophila melanogaster. We also highlight sex‐specific dominance as a potential mechanism of sex differences in immunocompetence, with population‐level sex differences primarily driven by sex differences in heterozygotes.