Frustrating.
I do this:
1. Realize they have the power.
2. Takes two to tango. He sounds uneducated. But maybe you were a bit impatient?
Listen first - so he feels heard. Let him say what he thinks, no matter how crazy it sounds. Let him get it all out of his system.
3. Say, " I hear what you are saying. I can see where you are coming from. If I understand you correctly, you................
< paraphrase what he said back to him. No sarcasm. This can work wonders. He now knows you understand what he wants.>
...............Do I have that right?"
Continue, "Do you mind if I explain how I understand it? Please let me know afterward if I can clarify any point I made, or where you disagree. I am certainly open to your input and expertise. I'd like to find the best solution."
This clarifies that you dont just want it YOUR way or HIS way - but the best way. One would assume this is what they want also.
4. If still an issue, ask for Code reference.
Without making him feel inferior or his judgement/intelligence called into question.
5. Now......If he says "You are gonna do it, cuz I SAID so!" (this happened to me once)
Explain, "Oh no. This inspection is over. We live in a free society. I need to be dealt with respect."
6. If bad enough, and you can afford to, never work in that area again. It just f$$&^ing ruins your day!
( I have eliminated one city from my business, due to an extremely negative encounter with the local AHJ. It feels good.
Any time I get a call from there, I make it clear to the customer how difficult their AHJ was. As citizens of that AHJ they can effect change.)