I was simply running my fingers on the fretboard with the amp off
You know that. We know that.
The officer either didn't know that, or he didn't care, but your attempt to educate him was surely a bad move.
Big picture: You probably wouldn't be plotting your defense right now if you had stopped fingering your axe and kept your mouth shut when you had the chance.
Law enforcement officers commonly look for signs of respect and cooperation, so they sometimes make silly little requests to get a read on a person's attitude. Your impromptu and unsolicited lesson on amplification and the cool-down only tipped your hand that you didn't mind debating and correcting the officer. Ouch.
Yeah, I also love all these maverick desperado types posting on here, so brave behind their keyboards, so willing to fight the law, thumb their noses at a law officer, beat the system and, in doing so, uphold social justice. How noble.
Sometimes, like this situation, it just doesn't make much sense.
Honestly, I hope OP beats the rap. But putting yourself in that compromising situation in the first place is just not the most prudent course.
Choose your battles, and choose them wisely.