Mets pitcher R.A. Dickey pitched through an injury all season. He was the best pitcher in baseball in 2012.

New York Mets ace R.A. Dickey’s Cy Young-caliber season has this remarkable wrinkle: It came while pitching with a torn abdominal muscle.

After making his final 2012 start on Tuesday night, Dickey revealed he tore and possibly detached the stomach muscle during his second start of the season, on a cold April 13 night in Philadelphia. He has dealt with “dull pain” in his stomach area throughout the season.

Dickey knew a couple of months ago, after undergoing an MRI, that he would require postseason surgery. He said he regularly prayed with his wife that he would be able to get through the season.

He will undergo surgery in Philadelphia on Oct. 18 to repair the tear, which is on his right side.

“The pain was fairly significant from time to time,” Dickey said. “We just did a good job of managing that. Whether it was backing off in the bullpen in between starts or getting the treatment that I needed or whatever else I needed to help with that pain, we were able to do it in a way that I was able to perform and not worry about it.”

The knuckleballer felt the pain worsen during Tuesday night’s start in the second inning.

“I’m not going to pretend to know what happened inside there, but it was much more significant than I have experienced in the past,” Dickey said. “Whether that is scar tissue coming loose or the tear elongating, it’s total speculation. I have no idea. But because we have a surgery already scheduled for the 18th in the same area, it’s going to get fixed then anyway.

“I guess the timing is fortuitous in that the significant pain that I’m feeling now, I hadn’t felt before. But, tonight, it was hard to catch my breath sometimes. It’s obvious that it needs to be taken care of. And we’re going to do that. It’s a pretty non-invasive surgery. I mean, I do have to go under (anesthesia) and they do have to repair a tear, but it should be a quick recovery.

“If you were asking me if I had another start in five days could I make it, I don’t know. But we were able to make 33 before this, and that’s pretty special.”

Dickey ultimately allowed three runs in six innings and received a no-decision in the Mets’ 4-3 loss to the Miami Marlins.

He finished the season with a 20-6 record and 2.73 ERA. His eight strikeouts Tuesday gave him 230 this season, most by a Met since David Cone had 241 in 1991. Dickey logged 233 2/3 innings, most by a Met since Johan Santana tossed 234 1/3 innings in 2008.

Dickey said he often wondered whether his remarkable season would be derailed by the injury.

“I was on my knees about it many times, hoping that it was not going to get more significant than it was,” Dickey said. “My wife and I prayed quite frequently together about that. I was in the middle of a good season and we were playing well. And it happened so early. When the All-Star break came, we were right in it and I was going good and felt fine and could keep going. Fortunately, we were able to last the whole year.

“The word from everybody is I’ll be walking a mile a day after surgery. I think they liken it to a sports hernia, if you will.”

Said manager Terry Collins: “First of all, he was absolutely brilliant all season long. From early in the year, he never let anything get in the way. Everybody is motivated by all the excitement he created, the run he had, the back-to-back one-hitters, the running up the W’s, being the guy. It was a tremendous year for him. I’m very, very proud of him. I’m very proud of what he’s done, what kind of person he is.

“There’s a lot of things that go on. This guy has been pitching with a bad stomach muscle for quite a while.”

…The Mets haven’t had a CY Young candidate in years and RA Dickey deserves to win this season. A knuckleballer that lead the league in strikeouts and innings at one point and finished the whole season with an injury that could have been serious. Are you kidding me? I am sure any other player would have called it quits and worried about his health. But Dickey fought through the pain after his second start and he made 33 starts this season. That means he pitched 31 hurt and I am sorry but that is remarkable. I can’t stress how much of a warrior this guy is in New York. If the Mets don’t pay him this winter, MLB and the Mets fans will be screaming from Queens to Albany in anger. But RA Dickey is a complete player and a better person. I pray that he recovers from this injury and has more success next season…