A top NYPD official is being probed for helping rockers Steven Tyler and Joe Perry obtain pistol licenses in return for alleged VIP treatment at an Aerosmith concert and ritzy after-party, The Post has learned.

Deputy Inspector Benjamin Petrofsky, the former head of the NYPD License Division, is the target of two probes into the circumstances that enabled Tyler and Perry to receive “carry permits,” which allow the rockers to legally possess concealed handguns in the Big Apple.

The NYPD Internal Affairs Bureau is trying to determine if Petrofsky violated departmental regulations when he cut through red tape to help Tyler and Perry, sources said.

The Manhattan district attorney’s office is reportedly examining whether or not, in return, Petrofsky got “illegal benefits” – a ticket to the show, backstage access and a limo ride to the Rock ‘n’ Roll Hall of Famers’ post-concert party.

Petrofsky, reached by The Post on Friday, declined to comment on the allegations, except to insist he had done nothing improper.

Sources said the flap arose in the fall of 2001 when Tyler, Aerosmith’s lead singer, and Perry, the band’s lead guitarist, approached the NYPD License Division for gun permits, sources said.

At the time, the rockers – whose fame and wealth has attracted stalkers over the years – already held gun licenses in Massachusetts and several other states, a source said.

Most applicants are required to show up at Police Headquarters to detail why they deserve a license, demonstrating they carry large sums of cash, work in dangerous jobs or had been the brunt of credible threats.

But insiders say some celebrities and other powerbrokers have quietly had the bureaucratic process streamlined for them.

On Nov. 12, 2001, Petrofsky, then a captain, allegedly traveled to Madison Square Garden with another cop to fingerprint the duo before an Aerosmith concert that night.

Both rockers were soon issued carry permits, though an NYPD spokesman declined to say what guns they’re licensed to carry.

The Internal Affairs probe was jump-started when a sergeant in the unit, Steve Oteri, secretly recorded the co-worker who accompanied Petrofsky bragging about their momentous night out, a source said.

Petrofsky was reassigned to the Intelligence Division when the investigation began, but since then has been promoted to deputy inspector.

He later admitted to investigators that he attended the Aerosmith concert, but only after paying an acquaintance for his ticket. The acquaintance, whose name is being withheld, spoke with The Post, insisting Petrofsky did not take a limousine ride nor attend a party.

“He’s a family man with five lovely kids, and the suggestion that he did anything improper is absolutely preposterous,” said another friend, Bo Dietl, a former NYPD detective.