A transgender Bronx woman with a history of suing the city claims she has been forced to turn tricks to finance the care of her dog, because the city barred the animal from her homeless shelter.

Mariah Lopez — a transgender-rights activist whose lengthy record of legal action against the city is rivaled only by her 15-year-long rap sheet — is demanding the city let her bring her boxer mix, Chica, into a homeless shelter in her latest lawsuit.

Born Brian Lopez, Mariah Lopez won a landmark 2007 suit that forced city taxpayers to foot the $20,000 bill for her sex-change operation.

She has sued the city at least half a dozen times, including three cases in which she claimed to have suffered abuse during or after arrests, and has won at least $51,000 in settlements between 2009 and 2015.

Now despite her six prostitution arrests dating to 2004, Lopez says the city has “forced” her into “sex work” in order to pay for the outside housing of her “service dog” after the Department of Homeless Services barred it from the Bronx shelter where she lives.

Lopez, who claims to suffer from post-traumatic stress disorder and problems with impulse control and anxiety, bragged about her love of litigation to Public Advocate Letitia James’ office in a letter vowing to take the dogfight to court.

“I’ve had the City Law department on its toes and reeling from [the] mistakes of those in public office before. I always win in the end,” she wrote.

Lopez claimed the city illegally demanded proof that Chica was a service dog. The pooch is trained to disrupt PTSD symptoms and lack of impulse control, she claims.

Under the Americans with Disabilities Act, a public entity can ask only two questions about service dogs: whether it is required because of a disability, and what task it is trained to do.

“We do not believe it is a service animal. We do not believe it performs any task,” a city lawyer argued during a Thursday hearing in the Manhattan federal court case.

The city welcomes service animals in shelters but needs time to find the best place to house them, the lawyer said.

Lopez complained about the financial burden of keeping her canine companion in Brooklyn.

“I have been doing sex work in the middle of bouncing back and forth between two boroughs,” she told federal Judge Valerie Caproni.

The judge gave her a three-day reprieve, or until Monday, to stay at the shelter with her dog.

“This is not a blank check to act like a jerk,” Caproni warned Lopez.

After inquiries by The Post, the city late Friday said it had approved Lopez’s pup through the normal process, clearing the way for the animal to stay with her in a shelter past Monday.

After the hearing, Lopez took to Facebook Live to crow about her victory.

“I won. I woooon,” she laughed into the camera. “Bitch, I always win!”