It is well known that a system of homogeneous second-order ordinary differential equations (spray) is necessarily isotropic in order to be metrizable by a Finsler function of scalar flag curvature. In our main result we show that the isotropy condition, together with three other conditions on the Jacobi endomorphism, characterize sprays that are metrizable by Finsler functions of scalar flag curvature. We call these conditions the scalar flag curvature (SFC) test. The proof of the main result provides an algorithm to construct the Finsler function of scalar flag curvature, in the case when a given spray is metrizable. Hilbert’s fourth problem asks to determine the Finsler functions with rectilinear geodesics. A Finsler function that is a solution to Hilbert’s fourth problem is necessarily of constant or scalar flag curvature. Therefore, we can use the constant flag curvature (CFC) test, which we developed in our previous paper, Bucataru and Muzsnay [‘Sprays metrizable by Finsler functions of constant flag curvature’, Differential Geom. Appl.31 (3)(2013), 405–415] as well as the SFC test to decide whether or not the projective deformations of a flat spray, which are isotropic, are metrizable by Finsler functions of constant or scalar flag curvature. We show how to use the algorithms provided by the CFC and SFC tests to construct solutions to Hilbert’s fourth problem.