Recently measured straylight PSFs in Hinode/SOT make granulation contrast in observed data and synthetic MHD data consistent. Data from earthbound telescopes also need accurate correction for straylight and fixed optical aberrations. We aim to develop a method for measuring straylight in the post-focus imaging optics of the SST. We removed any influence from atmospheric turbulence and scattering by using an artificial target. We measured integrated straylight from three different sources in the same data: ghost images caused by reflections in the near-detector optics, PSFs corresponding to wavefront aberrations in the optics by using phase diversity, and extended scattering PSF wings of unknown origin by fitting to a number of different kernels. We performed the analysis separately in the red and blue beams. Wavefront aberrations, which possibly originate in the bimorph mirror of the adaptive optics, are responsible for a wavelength-dependent straylight of 20-30% of the intensity in the form of PSFs with 90% of the energy contained within a radius of 0.6". There are ghost images that contribute at the most a few % of straylight. The fraction of other sources of scattered light from the post-focus instrumentation of the SST is only \sim10^-3 of the recorded intensity. This contribution has wide wings with FWHM \sim16" in the blue and \sim34" in the red. The present method seems to work well for separately estimating wavefront aberrations and the scattering kernel shape and fraction. Ghost images can be expected at the same level for solar observations. The high-order wavefront aberrations possibly caused by the AO bimorph mirror dominate the measured straylight but are likely to change when imaging the Sun. We can therefore make no firm statements about the origin of straylight in SST data, but strongly suspect wavefront aberrations to be the dominant source.