Legendary boxer Smokin’ Joe Frazier is in the final fight of his life.

Frazier, who gave the boxing world the “Thrilla in Manila,” and many other classic memories, is deathly ill with advanced liver cancer, The Post has learned.

“He’s in serious shape, we’re looking for a miracle,’’ said a source close to the former heavyweight champ. “They’re only giving him a short time to live. We need to have as many people as possible praying for Joe right now.’’

A fierce and smothering fighter with a devastating left hook, Frazier, 67, is considered one of the great gentlemen of the sport outside of the ring. His captivating bouts with Muhammad Ali put boxing in the spotlight for a new generation of fans as the sport truly became The Main Event. The “Thrilla in Manila,” the third fight of their epic encounters, was one of the greatest fights of them all.

Both boxers were near exhaustion when Frazier’s trainer, Eddie Futch, ended the fight in Ali’s favor after 14 punishing rounds. Ali entered the ring thinking he was fighting a washed up Frazier, and insulted Frazier often leading up to the fight, calling him a “gorilla.’’ Deeply hurt by the comments, Frazier came at Ali with a vengeance. At one point Ali, gaining new respect for Frazier, whispered in his ear: “Joe, they told me you was all washed up.’’

Ali could float like a butterfly and sting like a bee. Frazier was the ultimate brawler, yet in his own way, he could turn a phrase too. His response to Ali was classic: “They told you wrong, pretty boy.’’

Throughout those middle rounds, Frazier continued to come at Ali with vicious body blows. After the fight, Ali, who now suffers from Parkinson’s disease, admitted, “It was the closest I’ve come to death.’’

Frazier retired shortly after that battle and became an ambassador for the sport and more, including starting a singing career, billed as Joe Frazier and the Knockouts.

“Joe is one of the sweetest guys you could ever meet,’’ a friend told The Post. “Sometimes we’d be driving down the highway and see a car broken down and we would have to go out and help somebody. That’s Joe Frazier.’’

Frazier is a champion in and out of the ring.

The son of a South Carolina sharecropper, Frazier was on the 1964 Olympic team and won a gold medal. Over his career, he won 32 fights, 27 by knockout. He had four losses and one draw. He won his first 11 fights by knock out. In 1968, he beat Buster Mathis for the New York State world title at Madison Square Garden. He made six title defenses after that over the next several years and on March 8, 1971 fought Ali at the Garden in the incredible “Fight of the Century.’’

Over 300 million reportedly watched on closed-circuit TV. Ali-Frazier is what boxing was all about.

Frazier came into that first fight at 26-0 with 23 knockouts. Ali came in 31-0 with 25 knockouts. Ali was vehemently against the Vietnam War and refused to be inducted into the Army, causing him to be stripped of his title. Frazier was a symbol for the conservative moment.

This was a boxing war.

In the 15th round, Frazier landed a vicious left that knocked Ali down for a four-count. All three judges gave the fight to Frazier and the first of three battles was in the books as an instant classic, a big payday, a big production and a big finish.

After the “Thrilla in Manila’’ Frazier was never the same boxer. In 1973, George Forman knocked Frazier down six times in the first two rounds of their bout in Kingston, Jamaica, with Howard Cosell yelling what became a signature call for the broadcaster: “Down Goes Frazier!’’

Joe Frazier is down again. He always said, “What makes a champion is heart.’’

“Joe needs everyone’s prayers at this time,’’ said the friend.

Pray for the champ.