Most organisms are at risk of being consumed by a predator or getting infected by a parasite at some point in their life. Theoretical constructs such as the landscape of fear (perception of risk) and nonconsumptive effects (NCEs, costly responses sans predation or infection) have been proposed to describe and quantify antipredator and antiparasite responses. How prey/host species identify and respond to these risks determines their survival, reproductive success and, ultimately, fitness. Most studies to date have focused on either predator–prey or parasite–host interactions, yet habitats and ecosystems contain both parasitic and/or predatory species that represent a complex and heterogenous mosaic of risk factors. Here, we experimentally investigated the behavioral responses of a cactophilic fruit fly, Drosophila nigrospiracula, exposed to a range of species that include parasites (ectoparasitic mite), predators (jumping spiders), as well as harmless heterospecifics (nonparasitic mites, ants, and weevils). We demonstrate that D. nigrospiracula can differentiate between threat and non‐threat species, increase erratic movements and decrease velocity in the presence of parasites, but decrease erratic movements and time spent grooming in the presence of predators. Of particular importance, flies could distinguish between parasitic female mites and nonparasitic male mites of the same species, and respond accordingly. We also show that the direction of these NCEs differs when exposed to parasitic mites (i.e., risk of infection) versus spiders (i.e., risk of predation). Given the opposing effects of predation versus infection risk on fly behavior, we discuss potential trade‐offs between parasite and predator avoidance behaviors. Our findings illustrate the complexity of risk assessment in a landscape of fear and the fine‐tuned NCEs that arise in response. Moreover, this study is the first to examine these behavioral NCEs in a terrestrial system.