A 22-year-old woman was busted Thursday morning for trying to enter Brooklyn Criminal Court with a loaded gun and ammunition — just one week after the NYPD’s chief of department blasted the DA for going soft on weapons cases.

Keithia Lampkin, 22, placed her backpack on the magnetometer belt as she went through security, and eagle-eyed court officers spotted a loaded 9mm Beretta and eight hollow-point rounds, according to law enforcement sources.

One of the two arresting officers is a rookie.

“This is outstanding work by court officers, one of whom has been on the job for only a short time, in taking a very dangerous firearm and hollow-point bullets off the streets,” said Office of Court Administration spokesman Lucian Chalfen. “The prevalence of these handguns and the impunity with which they are carried around cannot be overstated.”

Lampkin allegedly planned to bring the backpack to pal Jevaughn Francis, who was in central booking awaiting arraignment on a drug charge, sources said.

She was charged with second-degree criminal possession of a weapon and related raps. She is awaiting arraignment in Brooklyn Criminal Court.

Lampkin’s brazen attempt to sneak into court with a gun comes just one week after NYPD Chief Terence Monahan criticized the Brooklyn DA for coddling gun-toters.

Monahan said 67 percent of defendants who pleaded guilty in gun possession cases under DA Eric Gonzalez were granted no-jail diversion programs.

“Our police officers are out there taking guns off the streets, and we just have to make sure that, as we go through the criminal justice process, that there are consequences for those arrests,” he said at a press conference July 8.

A spokesman for the Brooklyn DA insisted that only 10 percent of gun possession cases are diverted, not a third.