Be sure you know what to do and what to say. The last thing you want to say is "ehhh, ehhh, oops", but rather say "shoot, I'm not so good in these situations because X, I'm better at Y, perhaps we can do alternative Z?"
I can't fill in because X, better at Y, and alternative Z for you, but being honest about your shortcomings in interviews is not a bad thing. The last thing you want is to be in a job position that isn't a good fit for you personality, and good introspective abilities are always considered a boon (some of the most frustrating coworkers are those who aren't honest about this with themselves or their coworkers).
Offering an alternative also means there's an escape hatch. Do make sure that the hiring manager is convinced it's you answering the actual question or writing the code, and not someone on Stack Overflow (e.g. "can I get back to you about that tomorrow" could leave the wrong impression, so something like "can I write this down on my own without someone looking over my shoulder" might work better).
Also mentioning a strength means the conversation is not just focused on areas where you're not so good, but also on something you are good at. Few people are perfect, and all hiring managers realise this. What they're looking for is someone with a specific set of strengths and weaknesses.
Be sure to accurately identify the reason of this shortcoming; is it simply the social anxiety of having a stranger ask critical questions? Or is it stress in general? This can make a huge difference, as social anxiety is probably less of problem in the actual job, as it doesn't apply as much to the "we need this done by Friday"-sort of stress.
Do you have difficulty with stress in general? Then also be honest about that.