Serving two years for gun possession, Ja Rule found a new posse behind bars — a couple of cons he calls “Hevey D” and “Koz.”

The Queens-raised rap star says disgraced pol Alan Hevesi and corporate greed poster-boy Dennis Kozlowski took him under their wings.

From Kozlowski, he got stock tips. From Hevesi, he heard about the perennial impasse in Albany. They watched Jon Stewart and Stephen Colbert together.

“Outside, you don’t meet guys like this every day. This place is amazing,” Ja Rule told the Daily News during an exclusive interview at Mid-State Correctional Facility in upstate Oneida, N.Y.

The rapper, whose real name is Jeffrey Atkins, has been in prison since June for gun possession and tax evasion.

He’s not scheduled to get out until February 2013, but he’s getting ready for his new album, “Pain is Love 2,” to drop later this month — and networking.

“Koz just got out on work release. Not to say I wish he was still here,” he said. “But they’re both great, smart guys.”

Kozlowski, 65, is serving eight to 25 years for using the coffers of Tyco Inc. as a piggy bank.

He’s infamous for splurging on a $6,000 shower curtain and a $2 million party in Sardinia with an ice sculpture of Michelangelo’s David urinating vodka.

Ja Rule, 36, a married father of three, knows something about the luxe life, too.

When he was arrested on a gun charge in 2007, the weapon was in a $250,000 Maybach.

He’s sold 40 million records and gone platinum with nothing but a juggernaut voice and a talent for lyrics that resonate in neighborhoods like his own Hollis, Queens.

Ja Rule dropped out of high school. Hevesi, who has a Ph.D. from Columbia, and Kozlowski, who graduated from Seton Hall University, urged him to pursue higher education.

“I was studying for my GED and Koz came in and talked to me and said, if you need any help, let me know,” he said, two weeks after getting the degree.

The ex-CEO told him to buy airline stock and study business. He starts taking college-level courses this month.

His friendship with Hevesi, the former state controller who began serving one to four years in April for a “pay to play” corruption scheme, centers around politics.

“Hevey’s a Democrat like me, so that helps,” Ja Rule said. “He told me how it’s like pulling teeth with the two parties trying to get bills passed.”

Hevesi’s lawyer, Bradley Simon, confirmed his client gets along with the hip-hop star — and everyone else on the 23-man prison block.

“Alan reads books most of the day, but I know they all watch television together at night,” Simon said.

Hevesi, 72, isn't the first power player Ja Rule has met in prison: At Hudson Correctional Facility he played cards and basketball with Hank Morris, the strategist who pocketed $18 million in the pension scandal that doomed Hevesi.

“Hank was my Spades partner, and we were undefeated in basketball,” Ja Rule said.

“Hank had a jumpshot, man.”

Ja Rule, famous for feuds with other rappers, mused about the unlikely friendships he’s forged.

“It’s funny,” he said. “We’re from totally different walks of life. But when you’re here, you’re here.”