Former Secretary of State John F. Kerry is keeping the door open to running for president in 2020, putting him on a potential collision course in a Democratic primary with fellow Bay Stater, U.S. Sen. Elizabeth Warren.

Kerry, who just landed a job as a professor at Yale, suggested in an interview with The New York Times that he’s at least open to considering a run for the White House in 2020.

“I haven’t been thinking about it or talking about it,” he said. “I haven’t ruled anything in or anything out.”

But Kerry, who would turn 77 in 2020, might first have to knock out Warren, who is increasingly becoming the face of the Democratic opposition to President Trump. A Kerry-Warren matchup would be a Bay State political battle for the ages — but it wouldn’t be a close contest, said one political observer.

“There would be a lot of buzz going in, but when it comes to crunch time, she’d mop the floor with him,” said Boston University political historian Thomas Whalen.

“John Kerry is yesterday’s news in this state. He really is. Elizabeth Warren — whether you like her or not — she’s the future of the Democratic Party.”

Warren could go after Kerry as “the ultimate insider who’s enriched himself,” neglected Main Street and lacked accomplishments in the U.S. Senate, said Whalen.

“I guess he could still talk about the Big Dig,” said Whalen.

Kerry’s path to victory would be narrow and likely be reduced to invoking Warren’s claims of Cherokee heritage, which critics argue she exploited for career advancement.

“The only way he could beat her now is to go personal,” said Whalen. “He’d have to make sly comments about her Native American heritage. Did she lie?”

Kerry, whose infamous campaign gaffes have included trying to order a Philly cheesesteak with Swiss and referring to the Green Bay Packers’ stadium as “Lambert Field,” lost the White House in 2004 to President George W. Bush, 51 percent to 48 percent.

The prospect of two Massachusetts liberal pols fighting for the Democratic nomination would practically produce tears of joy for Republicans, said one GOP operative.

“This would be like the Super Bowl of cannibalization within the Democratic Party,” said strategist Ford O’Connell. “If somebody said the words ‘John Kerry’ to Donald Trump, he’d probably start laughing. ‘By all means, please, that would be very helpful.’ ”

Democrats did not seem ecstatic about the idea of Kerry reporting for duty again anytime soon.

“John Kerry was an excellent secretary of state, but he’s not the future of the Democratic Party,” said Democratic strategist Scott Ferson.

“This is the time to turn the page from Hillary Clinton, John Kerry, Joe Biden,” Ferson said. “2020 cannot be about nostalgia for what might have been.”