[Background]Spalangia endius (Walker) (Hymenoptera: Pteromalidae) is a solitary pupal endoparasitoid parasitizing many species of Diptera. This makes the species a good candidate for the biological control of flies. [Method] In order to understand host species preference of S. endius, "H" tube and Petri dish experiments were performed in the laboratory. [Result] When exposed to pupae of the fruit flies Bactrocera dorsalis and B. cucurbitae, the parasitoid preferred B. dorsalis, with the highest parasitization rate 61.11%. [Conclusion and significance] The detected preference by S. endius indicates that prey quality is important for this parasitoid, which can provide theoretical basis for possible mass rearing in attempts to control fruit fly pests.