As Madison Square Garden’s head carpenter for nearly 50 years, Malcolm Shaw has seen and done it all — enjoying a Forrest Gump-like career that’s seen him kiss the ring of Pope John Paul II, touch the Stanley Cup before even the Rangers copped a feel, and score ringside seats at “The Fight of the Century,” even though he was technically “working” that night.

Malcolm Shaw was in attendance during the “fight of the century,” a 1971 match between Joe Frazier and Muhammad Ali.Photo: AP Photo

“I had to be there in case of emergency — in case something happened to an exit door or a seat,” Shaw said of the 1971 bloodbath between Muhammad Ali and Joe Frazier.

“Every celebrity from America was here — from Frank Sinatra to Burt Lancaster to Ted Kennedy and his wife — anyone who was anyone was here. There were even the pimps from Harlem with their ladies of the evening.”

And it was extra special for Shaw, now 74, who as a lad growing up on the Falls Road in Belfast, Northern Ireland, was a huge boxing fan, following every punch of such pugilists as Sugar Ray Robinson and Joe Louis.

He immigrated to the United States in 1961, began working in construction, and in 1964 got his dream gig building a stage for the Bolshoi Ballet at Madison Square Garden, which at the time was on Eighth Avenue between 49th and 50th streets.

“Probably the three things from movies that I knew were the Empire State Building, the Statue of Liberty and Madison Square Garden, because that was the fight capital of the world,” he said.

Shaw helped lay down the Knicks’ maple-wood basketball court in 1968 — and kept a piece for himself when it was replaced during renovation in the ’80s. He held on to the block, collecting autographs from the Knicks players who won two championships on the floor in 1970 and 1973.

“Periodically, when people were around, I got them to sign it,” he said.

A ticket from the current Garden’s opening night in 1968, a USO show featuring Bob Hope and Bing Crosby.

Shaw is still hammering away, and this fall is back on the job at MSG, which has undergone a $1 billion transformation since 2011 and will include a special “Defining Moments” showcase featuring Shaw’s two tickets from the current Garden’s opening night in 1968, a USO show featuring Bob Hope and Bing Crosby.

“In the confusion of the opening night, the ticket-takers didn’t take them,” said Shaw, whose wife, Meta, attended the event.

More divine intervention helped Shaw get close to Pope John Paul II in 1979.

“When [the pope’s] limousine came up, the guy made the wrong turn. I happened to be standing right there. He got out of the limo to go to the Popemobile, and I happened to be at the right spot. By sheer luck, me and two other guys got to kiss the pope’s ring.”

The churchgoing Irish Catholic had only one reaction afterward.

Shaw touched the Stanley Cup before the Rangers players did in 1994.Photo: George Kalinsky

“I went, ‘Holy s- -t!’ ” he recalled.

In 1994, he again happened to be in the right place at the right time.

“I’m standing by the gate, and the Stanley Cup is being brought out. They have white gloves on . . . and I reached out to touch it before any of the Rangers did,” he said. “I’d probably get fired for that today.”

But there was one Garden low point for Shaw.

“Elvis Presley was my idol — ­Elvis of the 1950s, with his jeans and the whole bit. But then he came to Madison Square Garden in 1972 — I actually bought tickets — and he was in his Vegas mode with his white suit and pink scarf,” Shaw said. “I was so disappointed that I got up and I left.”