This study focuses on source term inversion in fractional partial differential equations, specifically applied to photoacoustic imaging. This work contributes to advancing imaging techniques and provides practical insights for medical diagnostics and materials characterization. Our aim in this paper is to develop an accurate method for recovering the location and the shape of a laser excitation source from partial boundary data. To achieve this, we reformulate our inverse problem as an optimization challenge. We utilize topological sensitivity analysis to establish an asymptotic expansion of a relevant shape function. These theoretical findings form the basis for a rapid and precise detection algorithm. Additionally, we present several numerical experiments that demonstrate the effectiveness and accuracy of our proposed approach.