The earwig Euborellia annulipes (Lucas) (Dermaptera: Anisolabididae), a generalist predator, has been observed in fruits infested with fruit fly larvae, which are frequently parasitized by parasitoid wasps. Neither the capacity of earwigs to predate on fruit flies nor intraguild interactions between earwigs and fruit fly parasitoids have been investigated. Here, we studied in laboratory conditions the predation on the fruit fly Ceratitis capitata (Wiedemann) (Diptera: Tephritidae) by the earwig E. annulipes, and whether parasitism of fruit fly larvae by the parasitoid wasp Diachasmimorpha longicaudata (Ashmead) (Hymenoptera: Braconidae) influences predation by the earwig. We evaluated the predation capacity, functional response and prey preference of E. annulipes for parasitized and non‐parasitized fruit fly larvae in choice and no‐choice tests. We found that earwigs prey on second‐ and third‐instar larvae and pupae of C. capitata and consumed larger numbers of second‐instar larvae, followed by third‐instar larvae and pupae. Females prey on larger numbers of fruit flies than did males, regardless of the prey developmental stage, but both sexes exhibited a type II functional response. Interestingly, males killed but did not consume fruit fly larvae more than did females. In no‐choice tests, earwig females consumed equal numbers of parasitized and non‐parasitized fruit fly larvae. However, in choice tests, the females avoided feeding on parasitized larvae. Subsequent tests with hexane‐washed parasitized and non‐parasitized larvae showed that putative chemical markings left on fruit flies by parasitoids did not drive the earwig preference towards non‐parasitized larvae. These findings suggest that E. annulipes is a potential biological control agent for C. capitata, and that, because the earwig avoids consuming larvae parasitized by D. longicaudata, a combination of the two natural enemies could have an additive effect on pest mortality.