On the morning of her arrest, Ms. Martin had set out from a friend’s apartment wearing a Lane Bryant tracksuit. The charges against her were eventually dropped but not before she was made to appear in court five times.

Over the past several years, the Legal Aid Society of New York has handled so many of these cases of wrongful arrest, particularly among transgender women who are black and Hispanic, that on Friday it filed a federal civil rights suit in the Southern District of New York on behalf of several plaintiffs — Ms. Martin is one of them — challenging the constitutionality of the law. Between 2012 and 2015, the Legal Aid Society says, nearly 1,300 people were arrested in New York City under the loitering law. More than 600 were convicted, and close to 240 served some time in jail. During that period, five precincts in the city were responsible for more than two-thirds of the arrests, each of the precincts serving neighborhoods that are predominantly black and Hispanic, in the Bronx and central Brooklyn.

The deployment of Statute 240.37 is, in essence, a perverse equalizer, extending the indignities of stop-and-frisk policing, experienced by so many young black and Hispanic men, to an entire population of women already facing myriad forms of discrimination. In one instance, the suit notes, over the course of two hours on a June evening last year, officers near Monroe College in the Fordham section of the Bronx arrested at least eight transgender women. The women told their lawyers that one of the officers said they were conducting a sweep to let “girls like them” and their friends know that if they were seen hanging around after midnight they would be hauled off.

The Police Department declined to comment on the suit until it was filed.

Some of the neighborhoods where transgender women are being arrested with some regularity — Bushwick, for example, and Hunts Point in the Bronx — are undergoing rapid gentrification, leading to the obvious supposition that the greater mission is to instill enough fear in the women to make them leave, and congregate somewhere else. Ms. Martin had been arrested 14 other times under the loitering statute in the early 2000s, she told me, in most instances while she had been in the meatpacking district, as it was evolving from a place of bohemian and transgressive club life to a world of croque-monsieur and Stella McCartney.

The policing of female sexuality is something bourgeois women talk about often, with little understanding that what exists largely in the realm of metaphor for them remains, for poor women, a very literal and criminalizing surveillance of how they present themselves when they leave the house. Again and again, the Legal Aid Society has represented women arrested while wearing short dresses or high heels or tight pants and, in one bizarre instance, that well-known symbol of sexual seduction: a black pea coat. Just as it is unthinkable that the same strictures would apply to a black man drinking a tallboy on a sidewalk in East New York and a private equity investor having a glass of pinot noir on his stoop on East 93rd Street, it is inconceivable that a woman in Chelsea would be stopped by the police on her way to Barry’s Bootcamp in cropped leggings and a sports bra.