Trade‐offs exist between the point of early detection and the future cost of controlling any invasive species. Finding optimal levels of early detection, with post‐border active surveillance, where time, space and randomness are explicitly considered, is computationally challenging. We use a stochastic programming model to find the optimal level of surveillance and predict damages, easing the computational challenge by combining a sample average approximation (SAA) approach and parallel processing techniques. The model is applied to the case of Asian Papaya Fruit Fly (PFF), a highly destructive pest, in Queensland, Australia. To capture the non‐linearity in PFF spread, we use an agent‐based model (ABM), which is calibrated to a highly detailed land‐use raster map (50 m × 50 m) and weather‐related data, validated against a historical outbreak. The combination of SAA and ABM sets our work apart from the existing literature. Indeed, despite its increasing popularity as a powerful analytical tool, given its granularity and capability to model the system of interest adequately, the complexity of ABM limits its application in optimizing frameworks due to considerable uncertainty about solution quality. In this light, the use of SAA ensures quality in the optimal solution (with a measured optimality gap) while still being able to handle large‐scale decision‐making problems. With this combination, our application suggests that the optimal (economic) trap grid size for PFF in Queensland is ˜0.7 km, much smaller than the currently implemented level of 5 km. Although the current policy implies a much lower surveillance cost per year, compared with the $2.08 million under our optimal policy, the expected total cost of an outbreak is $23.92 million, much higher than the optimal policy of roughly $7.74 million.