The military announced ­Tuesday that Marine Maj. Mark Thompson — who has long ­insisted that he was falsely accused of having sex with two U.S. Naval Academy students — will face a court-martial on allegations that he lied repeatedly in an effort to prove his innocence.

After revelations about Thompson’s case appeared in The Washington Post, the ­military charged him in April with making a false official statement and conduct unbecoming an ­officer and a gentleman. The former history instructor is ­accused of lying to a group of Marines who reviewed his case, pushing a comrade to lie for him at Thompson’s 2013 court-martial and lying to The Post about the two students.

Thompson will probably be arraigned in the coming weeks before facing trial this fall, ­according to Marine spokesman Rex Runyon.

At a preliminary hearing last month, Maj. Babu Kaza, the lead prosecutor, described Thompson’s career as a “fraud” and argued that he should be ­imprisoned for nearly three years, fined $200,000 and ­expelled from the service.

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

Thompson, 46, has maintained that he was unfairly ­convicted of sexual misconduct in 2013, but a Post investigation revealed in March that the ­19-year veteran had been ­dishonest when he testified ­under oath to an administrative board deciding whether he should be kicked out of the service.

The Marine Corps launched a new investigation soon after the article was published and has built a case in the three months since. Investigators met in April with one of the accusers, Sarah Stadler, to review the ­contents of her long-missing ­cellphone. A number of the more than 650 messages she and Thompson exchanged appear to contradict several assertions he made to the board in 2014.

The initial case against Thompson, who did not respond to a request for comment ­Monday, centered on an evening in April 2011. After a long day of drinking, Stadler and a ­21-year-old female classmate stopped by Thompson’s house, just off the academy campus in Annapolis. The women later told authorities that they played a drunken game of strip poker before he had sex with each of them. Stadler ­described her relationship with Thompson as consensual, but her friend accused him of rape, asserting that she was too drunk to consent.

Thompson’s longtime friend, Maj. Michael Pretus, testified at trial that in a call on the night of the alleged assault, Thompson told him that two midshipmen had stopped by to use the ­bathroom and left.

Pretus has since admitted to investigators that his testimony was false, according to a ­recording of their interview with him played at Thompson’s ­hearing last month. In reality, Pretus said, Thompson told him during their conversation that the ­women had gotten in the shower after Stadler’s friend threw up.

“You’re playing with fire,” he recalled telling Thompson, ­according to the taped interview.

Pretus — who has agreed to cooperate with prosecutors as part of an immunity deal — was removed from his position as a Naval Academy instructor in April following inquiries made by The Post about his role in Thompson’s case. In 2013, ­Stadler alleged that, while a student, she once had sex with both men at Thompson’s house. The allegation triggered an ­investigation into Pretus that ended only after he refused to ­cooperate, according to military ­records.

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

At his 2013 trial, Thompson was acquitted of rape but convicted of five lesser crimes. The next year, the ­administrative board found no proof that Thompson had done anything wrong and concluded that he shouldn’t have been found guilty.

Soon after, Thompson asked a friend to approach The Post on his behalf.

Pretus told investigators that he and others had warned Thompson not to publicize the story.

“I knew it was stupid. There were people who tried to talk him out of The Post article, but he wouldn’t hear it,” Pretus told investigators. “He was on an obsession course. You couldn’t get him to talk about anything else.”