Gerrit Cole of the Astros reacts after retiring the side...

Gerrit Cole of the Astros reacts after retiring the side in the seventh inning against the Rays in Game 5 of the ALDS at Minute Maid Park on Thursday in Houston. Credit: Getty Images/Bob Levey

HOUSTON — Gerrit Cole was almost a Yankee — twice.

It’s something to ponder when the hottest pitcher on the planet faces the Yankees in Game 3 of the ALCS on Tuesday afternoon at Yankee Stadium.

The Yankees drafted Cole as a high school player with the 28th overall pick in 2008, but he didn’t sign and went to UCLA. Three years later, he was drafted by the Pirates with the first overall pick and signed for an $8 million bonus.

The Yankees had a chance to trade for Cole two offseasons ago, when the Pirates were looking to move the righthander for prospects. The Yankees had extensive talks with Pittsburgh, but Cole was traded to the Astros on Jan. 13, 2018, for four players, including pitcher Joe Musgrove.

In his first season with the Astros, Cole went 15-5 with a 2.88 ERA. He was 1-1 in the postseason.

This season, Cole, 29, took his game to another level. He went 20-5 with a 2.50 ERA and struck out 326 in 212 1⁄3 innings.

He also went 2-0 with a 0.57 ERA in the Astros’ five-game ALDS triumph over the Rays. He allowed one run in 15 2⁄3 innings, struck out 25 and won the deciding Game 5 to send the Astros to the ALCS against the team Cole grew up rooting for — the Yankees.

As an 11-year-old, Cole attended Game 7 of the 2001 World Series between the Yankees and Diamondbacks in Phoenix. He was photographed before the game wearing a Yankees jersey and cap holding up a sign that read, “Yankee Fan Today, Tomorrow, Forever.”

The Yankees drafted Cole seven years later with their first-round pick out of Orange Lutheran High School in Orange, California. He went to college instead.

Cole, who will meet with the media at Yankee Stadium on Monday (and no doubt be asked about spurning the Yankees), once told the Los Angeles Times his reasons for not signing.

“We did a ton of thinking — just an absurd amount of thinking about this,” Cole said. “My dad has a Ph.D., and he’s a real visual kind of guy, so he made charts, and we went over financial figures, comparing people who are drafted in the first round and have somewhat of a baseball career with others who graduated college and the average gross of what they make in baseball and afterward.”

The Coles’ thinking was sound. Gerrit’s $8 million signing bonus in 2011 was twice what the Yankees reportedly were prepared to offer him in 2008. The Yankees were never given the opportunity to make an offer.

“We obviously had the scouting assessment correct,” Yankees general manager Brian Cashman said before Saturday night’s ALCS opener. “But signability we did not get correct. He was going to college. That was it. He never gave us a chance.”

Asked if he could take any solace from the fact that Cole had turned into the kind of pitcher the Yankees’ scouting department envisioned, Cashman said: “No.”

But Cashman had another chance to bring Cole to the Big Apple when the Pirates made him available after the 2017 season. Various reports have stated that Cashman balked at sending one of two infield prospects — either Gleyber Torres or Miguel Andujar — to the Pirates in a deal for Cole.

Cashman would not confirm the specifics of his talks with the Pirates.

“Quite simply, it’s in the eye of the beholder,” he said. “Pittsburgh, obviously, made a deal with the club that they thought had the best deal on the table. Simple as that.”

The Pirates received Musgrove and pitcher Michael Feliz, third baseman Colin Moran and outfielder Jason Martin. Thus far, none has had the impact of Torres for two seasons or Andujar for one (before he spent most of this season on the injured list).

Whatever happens this postseason — whether Cole and the Astros advance to the World Series or the Yankees do — Cashman will get a third shot at the righthander.

Cole will be a free agent after the season.

COLE FEAT

Gerrit Cole was 4-5 this season after losing to the White Sox on May 22. He hasn’t been beaten since. His regular season and postseason numbers:

REGULAR SEASON

W-L 20-5

ERA 2.50

WHIP 0.895

INNINGS 212 1⁄3

STRIKEOUTS 326

POSTSEASON

W-L 2-0

ERA 0.57

WHIP 0.574

INNINGS 15 2⁄3

STRIKEOUTS 25

SUBSCRIBE

Unlimited Digital AccessOnly 25¢for 6 months

ACT NOWSALE ENDS SOON | CANCEL ANYTIME