How about if he suddenly spots a long-unmet friend and makes his excuses, then?
Whatever sort of Intelligence test she is, he's worried that reaching the correct solution involves a +4 Intelligence headband he hasn't been issued yet... now there's an idea, mention to the Queen that he'd be happy and eager to receive his headband earlier. It's obvious in retrospect, but he'd also wager that most of the nobles present won't think of it.