IN-CROWD COOKOUT: NYPD bigs celebrated Labor Day with an apparently code-violating barbecue on the roof of Police Headquarters at 1 Police Plaza. Once a Post reporter spotted them, officers took pains to disguise their party.

When Ray’s away, the cops will play — and barbecue!

More than a dozen NYPD bosses fired up a pair of charcoal grills on a Police Headquarters rooftop for a questionable Labor Day cookout — taking an hours-long meal break while top cop Ray Kelly marched in a Brooklyn parade.

But the cops quickly scattered for cover when a Post reporter inquired about the barbecue — which appears to violate the city’s fire code — and all that was left hours later were the toppled barbecue grills.

The brazen brass kicked off their holiday meal around 11 a.m. on a secluded second-floor landing at 1 Police Plaza — cooking up hamburgers, hot dogs and other fare over open flames.

They spent several hours scarfing down the grub on a table laden with food and soft drinks.

Participants included bosses in the $49-million Joint Operations Center, which opened last year and is supposed to monitor possible terror attacks, as well as from the Real-Time Crime Center and Operations Division.

Many brought food inside and then came out for second helpings.

A ranking Fire Department officer also joined the party, which excluded the lowly uniformed cops who staff the building — where the aroma had wafted inside.

When a Post reporter first asked a cop if they were having a barbecue, he tersely replied: “Nope.”

But that cop immediately told another officer to set up a six-foot barrier that blocked sight of the police cookout.

A door leading to the landing was then shut — and only then did revelers take a pair of fire extinguishers from inside the building and put them near the grills.

While they scrambled to give the appearance of fire safety, Commissioner Kelly was at the West Indian Day Parade in Crown Heights that later exploded in violence, including two murders.

“Somebody’s gonna get grilled over this for sure,” said a police source.

Just last summer, a police supervisor put the kibosh on a cookout by building security elsewhere on the property after spotting smoke outside his window, another source said.

Police spokesman Paul Browne said the BBQ was not a problem for the Police Department.

Browne said “yes” when asked if cops can use grills anywhere on the premises of 1 Police Plaza.

When asked how the cookout was permissible under the city’s strict code — which allows exceptions only for fire training, film shoots, parks and residential property — he only said, “Sounds like you weren’t invited.”

An FDNY spokesman had no interest in picking a fight with his brothers in uniform.

“Doesn’t sound like any rules were broken,” said FDNY spokesman Frank Gribbon, though he noted they were never asked for permission. “If they wanted to use it with some frequency, we would consider granting a variance.”