Leptopilina heterotoma (Thomson) and Asobara tabida (Nees), solitary endoparasitoids of frugivorous Drosophila larvae, are assumed to be competitors. Olfactometer experiments showed, however, that the species differ in their preference for microhabitat odours. Whereas A. tabida prefers a fresh fermenting sugar/yeast medium, L. heterotoma prefers this medium in a later stage of decay. These results are confirmed by field observations. This temporal separation between the species, which is not complete because some multiparasitism does occur, may be one of the factors to their coexistence. Odour preference in L. heterotoma is not modified by larval conditioning, but conditioning of the adults significantly influenced their odour response. The ecological significance of such learning is discussed. It is argued that even though such behavioural flexibility may enhance foraging efficiency when resources are unpredictable, it may also influence the amount of competition between the two parasitoid species.