TORONTO – Raptors center Hakeem Olajuwon revealed yesterday he was closer than anyone realized to becoming a Knick last summer. Now Olajuwon is thrilled he nixed the Knicks.

Olajuwon told The Post the Rockets and Knicks had a sign-and-trade worked out in case he tabbed them as his final choice. Toronto won the Olajuwon sweepstakes because the 39-year-old future Hall of Famer sensed the Knicks were in decline and forced Rockets GM Carroll Dawson to trade him there.

“I’m glad I did, too,” Olajuwon said before scoring two points and shooting 0-for-7 from the field in the Knicks’ 96-92 win last night. “I saw a team [in Toronto] that clearly had the edge [over the Knicks], that could win the East, legitimately.”

“That Patrick Ewing era was gone,” Olajuwon said. “They have to go through the rebuilding stage. It’s natural. I know in New York there’s always a demand for them to win. They have to make that commitment to get somebody in the middle.”

Olajuwon said the Knick deal also included fellow Rockets free agent Shandon Anderson for Glen Rice and another Knick. GM Scott Layden and Dawson later worked out a Rice-for-Anderson swap with the Knicks also getting Dallas’ Howard Eisley.

“It was close, the deal was real,” Olajuwon said. “It was there. It was really a possibility. It could’ve happened. I gave it serious thought.”

Olajuwon said he spoke to Jeff Van Gundy “for a long while” on the phone. Van Gundy invited Olajuwon to visit but he never did. Olajuwon admitted being concerned with commuting from Westchester to the games.

“All my career, I’ve always imagined how difficult it is to play in New York because of the crowd,” Olajuwon said. “Whenever I play in the Garden, I thought about the inconvenience of the accommodations, getting to the games.

“But I thought it would be interesting to see what it would be like playing in New York. [Van Gundy] said all the right things, to come down, see how it feels. My mind was open.”

Dawson said he spoke to the Knicks but doesn’t recall specifics.

“I wasn’t paying much attention because we still were interested in signing him,” Dawson said. “We weren’t interested in any deal.”

The 7-footer believes he could have helped the Knicks avoid their crash.

“In the East, where everyone is so close talent-wise, having a big man is an edge,” Olajuwon said. “I think I could only help.”