Sen. Bernie Sanders (I-Vt.) couldn’t resist dropping a hint about a significant piece of news that broke during the Democratic primary debate on Tuesday night.

He was healthy, he insisted, despite having had a heart attack earlier this month. He’d be engaging in a “vigorous campaign all over the country,” including a “major rally” in Queens on Saturday.

“We’re going to have a special guest at that event,” Sanders said. The Post soon revealed the identity of that person: Rep. Alexandria Ocasio-Cortez, a freshman member of Congress who represents part of that New York borough and became a sensation in national politics after her surprise primary victory over a longtime incumbent last year.

This was all well-planned, of course. Sanders has been stagnant in 2020 primary polling for months, watching as Sen. Elizabeth Warren (D-Mass.) surged past first him and then former vice president Joe Biden in national polls. That Warren and Sanders share broadly similar political philosophies is a problem for him, a problem compounded by his recent health issues. So kill multiple birds with one stone: a big rally and a big endorsement from Ocasio-Cortez, arguably the new standard-bearer for the political ideology that Sanders popularized in 2016.

Ocasio-Cortez was one of the most-sought endorsements in the primary race specifically because of her popularity and energy. Perhaps only an endorsement from Barack Obama would be expected to generate as significant a splash. But it’s worth asking: How does the Ocasio-Cortez endorsement actually help Sanders?

I’d offer that there are two ways.

The first is that Ocasio-Cortez is popular with voters with whom Sanders needs some help. The most recent primary poll from Quinnipiac University has Warren and Biden essentially tied within the pool of Democrats and Democrat-voting independents who may vote in next year’s primaries and caucuses. Sanders is a distant third. But there are significant gaps between Warren and Sanders within several demographic groups that are worth highlighting.

Warren leads Sanders by 27 points with women, for example, and by the same margin with white Democratic voters. She leads by an average of 20 points with those older than 50 and by wide margins among those making more than $50,000 a year. Narrowing those gaps is critical for Sanders to regain his footing against Warren.

Which is where Ocasio-Cortez comes in (as you may have guessed).

Quinnipiac has polled on the favorability of both Sanders and Ocasio-Cortez, most recently in September for the senator and March for Ocasio-Cortez. Ocasio-Cortez’s profile has probably risen since then, thanks to President Trump’s attacks on her over the summer.

Overall, Sanders is more favorably viewed than Ocasio-Cortez nearly across the board. Only among those earning more than $100,000 a year is Ocasio-Cortez viewed as favorably.

But, then, far more people have no opinion of Ocasio-Cortez than of Sanders, thanks to the senator’s having been involved in politics for far longer. About 8 percent of Democratic voters didn’t have an opinion of Sanders. More than 4 in 10 said the same of Ocasio-Cortez.

What we can do, then, is adjust each politician’s favorability ratings to show how they’re viewed among those with an opinion. Once we do that, Ocasio-Cortez’s numbers improve significantly. For example, 85 percent of Democratic voters with an opinion of her in March viewed her favorably — about nine points higher than Sanders’s adjusted favorability.

Again, though, those margins vary by demographic. Among women with an opinion of both, Ocasio-Cortez is more favorably viewed than Sanders by 14 points. Among white Democratic voters, she’s 15 points more favorably viewed. Among the wealthiest Democratic voters? Eighteen points.

The differences are even more dramatic when you consider net favorability — favorability minus unfavorability. Once the poll numbers are adjusted to exclude those without an opinion, Ocasio-Cortez is 25 points more favorably viewed on net among women, 20 points more favorably viewed on net with whites and 28 points more favorably viewed on net among the wealthiest Democratic voters.

All groups with which Sanders needs to do better.

The campaign’s hope is clearly in part that Ocasio-Cortez’s popularity there could bolster Sanders’s own. It’s not a sure thing, certainly; some voters will probably adjust their opinions of Ocasio-Cortez following her endorsement and not their opinions of Sanders. But Ocasio-Cortez offers a big splash at an important moment with constituencies that Sanders needs to convert to his candidacy. It also might help persuade very liberal Democratic voters who favor Warren to swing back to Sanders, perhaps because the endorsement stalls any sense that Warren was seizing the liberal mantle.

Which brings us to the other way in which Ocasio-Cortez helps: By endorsing Sanders, she’s not hurting him.

Imagine if, instead of Sanders — for whom she worked in 2016 — Ocasio-Cortez backed Warren. The dynamics shift dramatically, giving momentum to Warren. It would also suggest that an influential leftist sees Warren, not Sanders, as the best carrier of the movement’s banner, a shift that would have been a massive blow to the senator from Vermont. Even if Ocasio-Cortez doesn’t significantly move voters to Sanders, it was important for Sanders’s team to ensure that she didn’t pull voters away.

The safe bet here is that the Ocasio-Cortez endorsement doesn’t move poll numbers much. It will be hard to know the effect, given the simultaneous combination of Sanders’s strong debate performance, reentry into the race and the endorsement. It is safe to assume, though, that an Ocasio-Cortez endorsement going to another candidate would have marked the effective end of the senator’s campaign.

Sanders’s candidacy fights on.