New York's sordid, stinking underbelly vomits up junkies and hoods, spews filth and crud over the city's finest, leaving them tangled in a jungle of courtroom technicalities, setting the scene for the battle between the good guys.

The good guys meet the better guys in ''Prince of the City," a draining, excruciating saga directed by Sidney Lumet, who refuses adamantly to decide for the judges, the lawyers, the cops or the feds. Instead, Lumet takes to task the process of bureaucratic do-goodery, which set out in 1971 to uncover police corruption via the Knapp Commission, whose biggest score, "The French Connection," was made for the movies.

After making the connection but not the indictment, the commission routinely interrogated every detective in New York's elite drug squad, the SIU, to gain evidence needed to shore up its bust. The city's great dope hope, its Special Investigating Unit, had 70 men who worked their own hours and assignments, coming into their offices only to file reports or pick up their checks. They were known as the "princes of the city" and they lived like royalty.

Robert Leuci was the crown prince of this self-indulging cadre, a crackerjack cop and the SIU team leader. Like the other detectives, he routinely supplied his stoolies with smack to keep those busts coming in. Because he wanted society's absolution, he went undercover for the Knapp Commission, a decision that made him heir to years of psychological terrorism imposed by the same feds who swore never to abandon him. Of his 70 compatriots, 52 were indicted, one went mad and two others committed suicide. "Prince of the City" is Leuci's story, but he is not its hero.

Treat Williams plays Leuci, who is given the pseudonym Danny Ciello for the film. Williams, who played a hippie in "Hair" and a hood in "Grease," is accustomed to anti- heroics and tilting at windmills. This is fortuitous, for he finds himself in a film without real valor or villainy. It's the story of a process, of paperwork chivalry. Williams must hold his little pug nose and leap into a river fueled with bureacratic testosterone, all murky with the good deeds of little gray men whose benevolence aims at gaining grander desk tops.

But Williams takes his dive with compelling relish. He is hopeful, naive, ingenuous. And although he can't help but look Irish, he makes an ingratiating Italian cop. It's an emotional part for Williams and for the men who play his four partners (Jerry Orbach, Richard Foronjy, Don Billett and Kenny Marino). Theirs is a tormented odyssey, beginning with backyard barbecues and dirty pictures, evolving into a supportive relationship worthy of a therapy group, and finishing in betrayal.

Orbach, Foronjy, the other partners -- in fact, most of the 126 actors with speaking parts -- deserve kudos: Heavy stuff performed flawlessly, lots of cursing and retching, hugging and slugging. The roles are gutsy, demanding, realistically racist and sexist. There's no room for blacks or women here. Rough white enforcers, breaking, bending or enslaved by the law, call the shots in this visually forceful work.

It's a pity that "Prince" runs for a numbing two hours and 52 minutes, detracting mightily from the truth with which the filmmakers would inculcate us. The infuriatingly slow pace proves a point, but it makes for a gritty-eyed viewer with mashed potatoes for brains.

It's a relief to escape the theater after this one, though it's good for several hours of discussion over dinner. It's not entertaining, but it does fall into the should-see category. Pop a couple of Stress-Tabs before you go.

PRINCE OF THE CITY -- At the Uptown.