As security officers approached, Desgroux stepped out wearing a "full military battle dress uniform" and displaying three stars that implied a rank of lieutenant general, Homeland Security Special Agent Tony Bell testified.
"He saluted the security officers, and they actually saluted him back," Bell said.
A suspicious security supervisor confronted Desgroux, who told him he was there to pick up a female employee to take her to Fort Bragg for a classified briefing that had been authorised by US President Donald Trump.
But none of it was true: Desgroux later acknowledged to federal agents that he had never served in the US military, Bell said.
The woman, a longtime acquaintance of Desgroux, expected him to arrive in a car for a visit.
Instead they went on a 30-minute helicopter ride around Raleigh, Bell said.
"She had no idea that he was flying a helicopter to pick her up," Bell said.
Bell testified that Desgroux wanted to pursue a romantic relationship, but the woman is married.
She and the pilot, who has not been charged, appear to have been swept up in Desgroux's strange behaviour.
"She didn't know what to make of it," Bell told the judge. "She just went along with it."
Bell testified that investigators suspect Desgroux is mentally ill, but didn't elaborate.
Still, the episode was no laughing matter. After the woman returned, the security staff notified local police - and a joint terrorism task force soon joined the case.
Desgroux also faces charges including an assault on his stepdaughter and violating a protective order taken out by an estranged wife, Bell said.