The numerical approximation of an inverse problem subject to the convection--diffusion equation when diffusion dominates is studied. We derive Carleman estimates that are on a form suitable for use in numerical analysis and with explicit dependence on the P\'eclet number. A stabilized finite element method is then proposed and analysed. An upper bound on the condition number is first derived. Combining the stability estimates on the continuous problem with the numerical stability of the method, we then obtain error estimates in local $H^1$- or $L^2$-norms that are optimal with respect to the approximation order, the problem's stability and perturbations in data. The convergence order is the same for both norms, but the $H^1$-estimate requires an additional divergence assumption for the convective field. The theory is illustrated in some computational examples.