You need to make sure it is from the headset. It could be play in the fork bushes, the headset, the disc rotor, the hub, the caliper, even rear shock bushes.
If it is from the headset, and you can’t tighten it out, chances are the top cap is tightening against the top of the steerer, so you need a few more mm of spacers 🙂
If it’s definately the headset but not being caused by that, there is a chance the headtube on the bike might be flared, and the cups are able to move in there. Fingers cross it’s not that.