Massachusetts Sen. Elizabeth Warren says the GOP plan to replace Obama­care will hurt sick people yet she was among just a handful of senators to vote against a bipartisan Obama-sponsored health measure that’s targeting billions at medical research, including for her home state.

“A health care bill that destroys care & affordable coverage for millions — seriously? What planet are these guys living on?!” Warren tweeted yesterday about the President Trump-backed replacement to Obama­care. “It’s time to junk this cruel #Trump­care bill before massive numbers of Americans are hurt by it.”

But just three months ago, Warren voted against the 21st Century Cures Act, which received the backing of the majority of both Democrats and Republicans, and poured billions of dollars into research for cancer, Alz­heimer’s and other medical programs.

Massachusetts is also a major beneficiary of the bill she opposed that was nevertheless signed into law before President Barack Obama left office.

Warren’s “no” vote raises questions about whether she’s putting her loyalty to her progressive base ahead of her sworn obligations to her own constituents.

“It’s the same sort of discrepancy of voting for Ben Carson for secretary of Housing and voting against him when she put her finger in the wind and found out it wasn’t popular to her base of progressive Democrats,” said state Rep. Geoff Diehl, a former Trump campaign co-chairman, referring to Warren’s flip-flop on Carson after fielding a massive backlash from the far left.

Colin Reed, the executive director of America Rising, a Republican PAC, noted the difference between her stances compared to the late Massachusetts senator and liberal lion Edward M. Kennedy.

“This ideological extremism does not play well in Massachusetts,” Reed said.

“Look at Ted Kennedy. He’d go out and make his point, argue extremely progressive, liberal ideals and then get to work with Republicans and get things done. That’s how legislating works. That doesn’t seem like something Elizabeth Warren is terribly interested in,” he said.

Lacey Rose, a spokeswoman, said, “Senator Warren opposes the Republican health plan because it would increase health insurance costs for millions of Americans, take away coverage from Massachusetts families, hurt hospitals’ bottom lines and blow a hole in the state government’s budget.”

Warren, Vermont Sen. Bernie Sanders and two other Democrats and one Republican voted against the Cures Act. She was also the only member of the Massachusetts delegation in both the House and Senate to vote against it.

Warren blasted the legislation at the time because she claimed Republicans had let “Big Pharma hijack” the bill. She decried language she claimed would weaken anti-fraud laws against drug companies, keep secret their “splashy junkets” and dole out deals to a major Republican donor. Her office said last night she voted against the Cures Act because it didn’t guarantee funding for research and treatment.

Yet the bill also poured more than $6?billion into medical research, an area where Massachusetts, as a major mecca, stands to benefit. Some $4.8?billion went to the National Institute of Health, including for brain cancer research and the Beau Biden Cancer Moonshot initiative. More than $1?billion was earmarked for Alzheimer’s research and another $1?billion went to the states to combat opioid abuse.

“I support most of these proposals,” Warren said on the floor of the Senate. “I’ve worked on many of them for years. … But I cannot vote for this bill. I will fight it because I know the difference between compromise and extortion.”

Warren has been bruited about as a Democratic presidential contender in 2020, when she would need enthusiastic progressives who believe she’s the real deal. She also faces reelection to the U.S. Senate in 2018 in Massachusetts, which, although a liberal bastion, still has a fierce independent streak that has elected former U.S. Sen. Scott Brown and Gov. Charlie Baker. Among those mentioned as a possible challenger to Warren are ­Diehl and ex-Red Sox pitcher Curt Schilling.