NEW YORK — Aaron Judge keeps his postseason memories close, and the failures closer.

So much that ahead of his third trip to the playoffs with the Yankees, he has found himself rewatching video of the 2017 and 2018 postseasons.

“My biggest motivator and biggest lessons I’ve learned are always from failure,” Judge said Thursday before the Yankees’ workout was forced indoors by inclement weather. “I just think back to a lot of those games in ’18; the little things. The little things we missed out on, the little details we missed that might not have affected a certain play but affected us later in the game or affected something later on. Failure is — that’s a tough pill to swallow, but it can always be one of your biggest motivators.”

In 2017, the Yankees were eliminated in Game 7 of the American League Championship Series by the Houston Astros. A year later, their postseason didn’t get that far, with the Yankees losing in four games to the Boston Red Sox in the division series.

Back in February, the wounds from both postseason disappointments were fresh, and they still are.

“Failure leaves a sour taste in your mouth,” said Tyler Wade, likely one of the reserves on the Yankees’ ALDS 25-man roster. “You go into the offseason … and you see them celebrating … and you think to yourself, ‘Man, if a couple of things went our way. … ‘I think that motivates you. It has given us an extra edge. Since spring training we have had that motivation and that chip on our shoulder.”

Center fielder Brett Gardner will be the only player on the ALDS roster who knows the elation of getting to and winning a World Series wearing pinstripes.

“What happened the last couple of years is still very fresh in our minds. Any time you get that close to something and fall a little short sometimes it hurts even worse than not getting close at all,” said Gardner, one of two remaining members of the 2009 championship team alongside CC Sabathia, who is not active for the ALDS due to a sore shoulder.

“The last couple years, getting knocked out by the eventual World Series champion, more than anything we use those experiences to be motivated, not only by the failure, but also by learning from what we didn’t do well enough. We know what we need to do to win and our plan is to go out and do that.”

Outfielder Giancarlo Stanton experienced postseason play for the first time in 2018, with a less than stellar performance in the ALDS, going 4-for-18 with six strikeouts and no extra-base hits or RBI.

“You know that feeling of failure,” said Stanton, who did hit a home run in the Yankees’ wild-card victory over the Athletics. “You look back and think of the ‘what ifs’ and ‘could’ves.’ So you do see it as motivation, but at the same time you can’t put more pressure on yourself because that gives you less of a chance to succeed. You understand the pressure, you have your time with it, and then you better get over it. Quick.”

And for Judge, a 103-win season and capturing the franchise’s first AL East title since 2012 mean nothing.

“Any year you’re not the last man standing, the season is a fail,” he said. “You can win every single game in the regular season, but if you lose in the postseason it doesn’t matter. Each year, it left a bad taste in my mouth, especially Game 7 in Houston, Game 4 here at home, losing on our home turf to our AL East rivals; never a good taste going into the offseason. But [for] a lot of guys, that keeps us hungry.”

“This is the regular season,” Judge added. “They can say that 162 is the regular season, but that’s spring training. This is when it counts. This is when it all counts. This is when it matters.”