Rafael Nadal will be able to sleep at night even if he does not set the record for most Grand Slam titles. But the Spanish Bull will sleep better if he does retire with that honor.

It’s a genuine possibility now, especially if Nadal knocks off the young but dangerous Russian rocket, fifth-seeded Daniil Medvedev, the tour’s hottest player, in Sunday’s U.S. Open men’s final.

The crowd of 23,000 at Arthur Ashe Stadium will be sent into a tizzy if the left-handed baseline machine notches his 19th Grand Slam title and crawls one major away from tying Roger Federer’s record 20.

“I would love to be the one who achieves more Grand Slams, but I still sleep very well without being the one,’’ Nadal said. “I am happy about my career. I would love to be the one to have more, yes, but you cannot be all day frustrated or all day thinking about what’s your neighbor have better than you.”

It would have been sweeter if a finals triumph had come at the expense of Federer, but he was bounced in the quarterfinals and may end his career stuck on 20. Incredibly, Nadal and Federer have never met on the court at Flushing.

Legend John McEnroe, who spent Saturday at his academy at Randall’s Island SPORTIME facility giving out eight BNP Paribas tennis scholarships to kids, based on financial need, said he believes it “probable’’ Nadal and Novak Djokovic (who has 16 Slam titles) will surpass the Swiss Maestro one day.

McEnroe, speaking at his appearance for the Johnny Mac Tennis Project, said he is more concerned about calling a close match Sunday for ESPN. As scorching as the crafty Medvedev, 23, has been, his worst day came Aug. 11 against Nadal in the Montreal finals, when he was wiped out 6-3, 6-0.

“We’re all wondering that: Is it a bad matchup or was [Medvedev] fried from that week?’’ McEnroe told The Post. “[Medvedev] is one of the best strategic thinkers of the young kids I’ve seen in 10 years. The way he plays makes [opponents] feel uncomfortable.

“I’m hopeful it lives up to what it could be because it could be a great match. It will depend how [Medvedev] feels physically, how his serve is going. Hopefully it’s going to be tight. I like him a lot. I’m cautiously optimistic it’s going to be close.”

Nadal said the fact it was a windy day in Montreal played havoc with Medvedev’s game.

“Here the wind is not there,’’ Nadal said referring to the Ashe Stadium structure. “Honestly, I think he’s making the steps forward every single day. Is a super tough final. I need to be playing at my best and hold this level if I want to have chances on Sunday.’’

Flushing was never a panacea for Nadal early in his career. He used to break down physically at the end of a long year on the hardcourts. He didn’t win his first U.S. Open until 2010 in his eight try. Now he’s favored to ring up his fourth Open.

“I think at the beginning of my career have been some tough moments here,’’ Nadal said. “But since then, [when] I came here I felt comfortable, no? I like the atmosphere, I like the crowd. I feel a big energy when I am playing in this stadium.’’

Nadal has the raw power and speed to overwhelm Medvevev, who relies on unique angles and offbeat spins and slices. McEnroe has fallen in love with the Russian this summer. The Flushing crowd, which booed Medvedev earlier in the tournament for raising his middle finger at the fans, has grown to appreciate his artistry.

McEnroe imagines Medvedev has a future as a Grand Slam champion.

“The only thing I’m worried about [is] physically. He’s pretty skinny and it’s how he holds up physically,’’ McEnroe said. “It’s whether that would catch up to him. But now he’s very strong. It’s a breath of fresh air to see a guy who thinks like a chess player.”

Nadal, 33, said the era of the Big Three “is going to end’’ sooner than later. One from among Nadal, Djokovic and Federer has won every Slam since Stan Wawrinka took the 2016 U.S. Open.

“If I am able to win on Sunday, it will be amazing,’’ Nadal said. “If I lose, I hope to keep having chances in the future to add things.”