Bactrocera oleae (Rossi) (Diptera: Tephritidae) is considered the most devastating pest of the olive tree worldwide. In an effort to develop management and biological control strategies against this pest, new molecular tools are urgently needed. In this study, we present the design of B. oleae-specific primers based on mitochondrial DNA sequences of cytochrome oxidase subunit I (COI) gene. Two pairs of B. oleae-specific primers were successfully designed and named as SBo1-F/SBo1-R and SBo2-F/SBo1-R, being able to amplify 108 and 214 bp COI fragments, respectively. The specificity of designed primers was tested by amplifying DNA from phylogenetically related (i.e. Diptera order) and other non-pest insects living in olive groves from the Mediterranean region. When using these primers on a PCR-based diagnostic assay, B. oleae DNA was detected in the gut content of a soil-living insect, Pterostichus globosus (Fabricius) (Coleoptera: Carabidae). The detection of B. oleae DNA in the guts of arthropods was further optimized by adding bovine serum albumin enhancer to the PCR reaction, in order to get a fast, reproducible and sensitive tool for detecting B. oleae remains in the guts of soil-living arthropods. This molecular tool could be useful for understanding pest–predator relationships and establishing future biological control strategies for this pest.