Take a look at the photo below so we can all be working from the same playbook.
I suspect that you mean that the fork is stripped where the top race (aka top cup) goes, and you're trying to hold it together using the locknut only. That can work, but there's no way to lock the adjustment.
You do have a few workarounds if there's no other option. One would be to use a Loctite product to keep the locknut from unscrewing. Or you might try putting a hose clamp around the stem, pushed down against the locknut so it can't spin back up and unscrew. Those are just ideas for salvaging a fork that otherwise would go to the scrap man, but the "right" option is to do just that.