There they were: D.C. Mayor Vincent C. Gray (D) and D.C. Council member Marion Barry (D-Ward 8) in the basement of a Southeast Washington church. Famed attorney Robert S. Bennett sat in his well-appointed Connecticut Avenue office. The last time the three were in each other’s orbit, there were findings of wrongdoing and unprecedented punishment.

That was March 2010, a few weeks before Gray announced his candidacy for mayor and nearly a year before details of his victory instigated a federal investigation that ultimately revealed monumental campaign-finance fraud. Then, Gray was council chairman; he rallied his colleagues to censure Barry following a probe of the handling of grants, earmarks and contracts.

Bennett, serving as a pro bono special counsel, accused Barry of impeding that investigation and alleged that he had violated D.C. laws governing conflicts of interest and standards of conduct when he issued a “personal services” contract to paramour Donna Watts-Brighthaupt. Barry, Bennett said, received a kickback, although Barry insisted it was repayment for a loan he had made to Watts-Brighthaupt. Led by Gray, legislators stripped Barry of his committee chairmanship and, following Bennett’s advice, referred the matter to the U.S. Attorney’s Office. While the Office of Campaign Finance said months later that Barry did not break any laws, it did admonish him and found he violated “employee conduct” regulations. The feds already had Barry in their grip for failing to file tax returns; he was on probation.

Now the trio is back together again — but with a twist: Gray is under federal investigation, Bennett is his lawyer and Barry has come to the rescue.

Don’t you love a farce?

Gray and Bennett expect an indictment, especially after campaign financier Jeffrey E. Thompson — a.k.a. Uncle Earl — declared in court that the mayor knew about the illegal, nearly $700,000 shadow operation that helped buy Gray the 2010 election. The lawyer and the client have vowed to fight, going to trial if necessary.

Last week, Barry, the peripatetic two-term legislator and serial ethics violator, endorsed Gray for reelection. He used the occasion to trash U.S. Attorney Ronald C. Machen Jr. while calling Gray a “man of integrity.”

But did Gray need Barry’s back-slapping, racially charged seal of approval? Not really.

The mayor’s team may have been experiencing an anxiety attack, just as it did in 2010. Not unlike then, Gray is concerned about turning out his base, particularly in Wards 7 and 8, east of the Anacostia River. Hoping to shore up that support, Gray and his minions decided to go all-in with Barry.

Truthfully, the folks who, election after election, welcome Barry’s pontificating, pandering and race-baiting are probably already in Gray’s corner. Many of them see the federal investigation of the incumbent as another effort to bring down a black man — never mind that prime characters in this drama are all African American men.

Still, voter turnout east of the river can be unpredictable. Without an extraordinary effort to get voters to the polls — a la a shadow campaign — or absent a targeted enemy to excite them, as then-Mayor Adrian M. Fenty did in 2010, many may just sit out Tuesday’s primary.

Thus the campaign has begun fashioning a trifecta of enemies: It already made the media villains. This week it began portraying Council member Muriel Bowser (D-Ward 4) as inexperienced and a Fenty clone; she is this season’s Public Enemy No. 1. Next in line is Machen.

At least one Gray supporter has accused the U.S. attorney of professional misconduct. Others, including Bennett, have suggested that Machen is out to get the mayor. Hearing that, I was reminded of Barry’s infamous phrase, “Bitch set me up.” They forget, however, that Gray requested the federal investigation — although for three years, after claiming he wanted to get to the bottom of things, he has refused to meet with Machen.

Gray’s victimhood is a campaign contrivance, defying credulity. Thus far, it’s not working. In a recent Post survey, 27 percent of respondents supported Gray while 30 percent backed Bowser. Only 9 percent is undecided — a significantly smaller number than in a Post poll in January. It appears many undecideds have been breaking for Bowser. While she has slightly less money than Gray, she has a solid political organization with tons of volunteers.

Still, it’s too soon to call the race. Some of Bowser’s support is soft. The Post reported that her supporters “appear to be more persuadable and less certain,” and 43 percent of voters in the four wards where Bowser is doing best support someone other than her or Gray. The decision of Tommy Wells (D-Ward 6) not to accept corporate dollars means he has a significantly smaller amount of cash than his opponents, but he appears to be gaining fans, including firefighters, who seem to be going all out for him. It’s possible that supporters of Council member Jack Evans (D-Ward 2) and businessman Andy Shallal, seeing their candidates lagging behind, could jump to Wells. Moreover, Wells, now running third, could become the unintended beneficiary of Gray’s attack on Bowser.

This much is clear, however: Gray is tapped out. There isn’t much room for growth. He can’t afford to have any segment of his base stay home next week. If that happens, come April 2 the Democrats will have a new mayoral nominee.