Drosophila melanogaster is an outstanding model to study the molecular and functional basis of host-pathogen interactions. Currently, our knowledge of microbial infections in D. melanogaster is well understood; however, the response of flies to nematode infections is still in its infancy. Here, we have used the potent parasitic nematode Steinernema carpocapsae, which lives in mutualism with its endosymbiotic bacteria Xenorhabdus nematophila, to examine the transcriptomic basis of the interaction between D. melanogaster and entomopathogenic nematodes. We have employed next-generation RNA sequencing (RNAseq) to investigate the transcriptomic profile of D. melanogaster larvae in response to infection by S. carpocapsae symbiotic (carrying X. nematophila) or axenic (lacking X. nematophila) nematodes. Bioinformatic analyses have identified the strong induction of genes that are associated with the peritrophic membrane and the stress response, as well as several genes that participate in developmental processes. We have also found that genes with different biological functions are enriched in D. melanogaster larvae responding to either symbiotic or axenic nematodes. We further show that while symbiotic nematode infection enriched certain known immune-related genes, axenic nematode infection enriched several genes associated with chitin binding, lipid metabolic functions, and neuroactive ligand receptors. In addition, we have identified genes with a potential role in nematode recognition and genes with potential antinematode activity. Findings from this study will undoubtedly set the stage for the identification of key regulators of antinematode immune mechanisms in D. melanogaster, as well as in other insects of socioeconomic importance.