The instability of an incompressible boundary-layer flow over an infinite swept wing in the presence of disc-type roughness elements and free-stream turbulence (FST) has been investigated by means of direct numerical simulations. Our study corresponds to the experiments by Örlü et al. (Tech. Rep., KTH Royal Institute of Technology, 2021, http://urn.kb.se/resolve?urn=urn:nbn:se:kth:diva-291874). Here, different dimensions of the roughness elements and levels of FST have been considered. The aim of the present work is to investigate the experimentally observed sensitivity of the transition to the FST intensity. In the absence of FST, flow behind the roughness elements with a height above a certain value immediately undergoes transition to turbulence. Impulse–response analyses of the steady flow have been performed to identify the mechanism behind the observed flow instability. For subcritical roughness, the generated wave packet experiences a weak transient growth behind the roughness and then its amplitude decays as it is advected out of the computational domain. In the supercritical case, in which the flow transitions to turbulence, flow as expected exhibits an absolute instability. The presence of FST is found to have a significant impact on the transition behind the roughness, in particular in the case of a subcritical roughness height. For a height corresponding to a roughness Reynolds number
$Re_{hh}=461$
, in the absence of FST the flow reaches a steady laminar state, while a very low FST intensity of
$Tu =0.03\,\%$
causes the appearance of turbulence spots in the wake of the roughness. These randomly generated spots are advected out of the computational domain. For a higher FST level of
$Tu=0.3\,\%$
, a turbulent wake is clearly visible behind the element, similar to that for the globally unstable case. The presented results confirm the experimental observations and explain the mechanisms behind the observed laminar–turbulent transition and its sensitivity to FST.