Former U.S. Naval Academy instructor Mark Thompson has been accused by the military of persuading a fellow Marine officer to lie under oath about Thompson’s sexual encounters with two female midshipmen, according to the criminal filing obtained by The Washington Post.

Thompson, a Marine major who insisted that he had been unfairly convicted in 2013 of sexual misconduct with the students, faces new charges in the case, including making a false official statement and two counts of conduct unbecoming an officer and a gentleman.

His longtime friend, Maj. Michael Pretus — a key witness for the defense — offered false testimony about Thompson’s threesome with the two women, authorities said in the charging documents. This week, Pretus was removed from his position as an instructor at the Naval Academy after being implicated in the sexual misconduct scandal. He told The Post on Sunday that he will now testify for the prosecution against his friend.

[A Marine fights to prove he’s innocent of sexual misconduct. Then a lost cellphone is found.]

At Thompson’s court-martial three years ago, Pretus testified that on the night of April 30, 2011, he and Thompson spoke several times over the phone about Pretus’s crumbling marriage. During one call, Pretus said, Thompson told him that two drunk midshipmen had stopped by to use the bathroom, done so and left.

That testimony “was false,” according to prosecutors. They allege that, in reality, Thompson told Pretus the two women “were at his house, were naked, and had engaged in sexual contact with him.”

That is consistent with what the accusers, Sarah Stadler and a younger classmate, told the jury. They asserted that Thompson served them shots of tequila before they played strip poker and staggered to his bedroom, where he had sex with both of them. Stadler called the sex consensual and part of an ongoing relationship. Her friend said she had gotten too drunk to consent and was raped.

Prosecutors allege Pretus also lied to the Naval Criminal Investigative Service, falsely stating in a March 2013 interview “that he was unaware of any dating relationship between” Thompson and Stadler.

In addition to allegedly soliciting Pretus’s false testimony, Thompson has been accused by prosecutors of making a false official statement at a 2014 administrative hearing and of lying about the women to The Post.

If convicted of lying under oath, Thompson could face up to five years in prison, a dismissal from the service and a total loss of his retirement benefits. The Marine Corps will hold an Article 32 preliminary hearing in May in Quantico, Va., to determine whether the case should proceed to a court-martial.

Thompson, who served in Afghanistan, has long fought to prove that he was falsely accused of having sex with the women, but a Post investigation revealed that he had been dishonest when he testified under oath to the administrative board that was deciding whether he should be expelled from the Marines. Asked in January why he had lied to authorities, Thompson described the immense pressure he faced after Stadler’s friend asserted that he had raped her.

“I simply had to, when they were coming after me for 41 years,” Thompson said. “I can’t begin to say, you know, how terrifying that is.”

Thompson, who did not immediately respond to a request for comment, was acquitted of the rape charge but found guilty of five lesser offenses. He served two months in a military prison and was fined $60,000.

Midway through the trial at the Washington Navy Yard, Stadler spotted Pretus at a hotel where witnesses were staying and told authorities that she had once had a threesome with him and Thompson. The accusation led to a criminal investigation into Pretus, which ended, military records show, after he refused to cooperate and invoked his right to remain silent. One year later, Pretus became an instructor at the Naval Academy, teaching history and serving as a mentor to midshipmen who aspire to become Marines.

[Naval Academy teacher is removed amid widening sexual misconduct scandal]

In 2014, a year after Thompson’s sexual misconduct convictions, his case was reviewed again at what is known as a board of inquiry hearing. There, three Marine officers were assigned to decide whether Thompson should be discharged for his crimes.

Thompson, the charging documents say, made a number of false statements to the board members “with intent to deceive.”

The combat veteran testified that he was never friends with Stadler outside the rifle team, a group with which he volunteered as military representative, insisting that his interactions with her were appropriate, professional and within academy guidelines.

He told the board that Stadler had created “a complete fiction about a relationship that never existed” — and specifically denied ever having any sexual conversations with her. The board members believed Thompson, allowing him to remain a Marine and even decrying his convictions as unjust. Soon after, Thompson asked The Post to examine his case, arguing that he was innocent.

Among the lies prosecutors assert that Thompson told: his denial that he had a sexual relationship with Stadler and her friend or that he played strip poker and drank alcohol with them on April 30, 2011, and his insistence that the last time he remembered seeing Stadler was that night.

Many text messages on Stadler’s old phone — which she discovered after being contacted by The Post — strongly imply that the two were involved in an inappropriate relationship. One exchange was sexually explicit.

The texts also revealed that Thompson had misrepresented to the board the last time he saw Stadler, who in 2014 was dismissed from the Navy for lying about her relationship with an enlisted sailor. She had alleged during Thompson’s trial that they had sex a final time on the night of her May 2011 graduation, a time when Thompson had a compelling alibi. The texts, however, show that the two actually saw each other at 11:30 the following night.

At his board hearing, Thompson testified that the last time he remembered seeing Stadler was nearly one month earlier.

When confronted by The Post, Thompson acknowledged that Stadler had come to his house the night after graduation but insisted she did so only to give him a pair of commemorative glasses and her photograph. He still denied ever having sex with her.