An NYPD sergeant who once worked in first lady Chirlane McCray’s personal security detail has coiffed up quite an excuse after testing positive for marijuana: She’s claiming the department mistakenly tested a strand from her human-hair weave.

The hair-brained claim is the latest bid by Sgt. Tracy Gittens to keep her job after a random drug test came up positive for pot and she was pulled from overseeing security at Gracie Mansion, sources tell The Post.

The 13-year department veteran — who has been on paid desk duty in Queens since this winter and is awaiting a departmental trial — insists that when she was tested, technicians unknowingly collected strands of human hair from her weave.

They snipped from the back of her head, where she couldn’t see, sources said she is claiming — and had they tested her actual hair, it would have been clean of drugs.

“She doesn’t smoke marijuana and she’s unaware how it may have gotten into her system,” one police source told The Post. “That’s why she’s thinking it may have been the weave.”

Other colleagues say it’s tuft to believe.

“Oh stop; it doesn’t even pass the laugh test,” scoffed one police source. “That’s one of the lamest excuses I’ve ever heard. What people will do to save their jobs is pathetic.”

Another cop said the sergeant should have said she was wearing a weave at the test site, if she was concerned.

“She should have said upfront ‘That is not my real hair’ so they could take the hair from somewhere else. I’ve heard every excuse, but those tests are 100 percent accurate and I tend not to believe her story.”

Gittens did not respond to requests for an interview; her lawyer, John D’Alessandro, also declined to comment.

She’s not the first cop to attempt a crazy-sounding dodge after testing positive for pot. In 2006, an anti-terror detective, Anthony Chiofalo, claimed his wife had laced his meatballs with marijuana without telling him in hopes that a positive drug test would force him into retirement.

The “spacey meatball” defense failed utterly. Chiofalo was fired; two years later, he lost a Manhattan Supreme Court lawsuit that claimed the firing was “arbitrary, capricious, unreasonable and unconstitutional.”​