The scriptwriters for "Miami Vice" couldn't have concocted a better cast of characters. Or a juicier plot.

Start with a group of young police officers -- cocky, aggressive and, to all outward appearances, without blemish. Each has a fistful of commendations; one was about to named "officer of the year" by the Miami Rotary Club.

But then last summer, acting on a tip, detectives began investigating these same officers, and allegedly found startling behavior for $25,000-a year policemen. Investigators say one turned up drinking Dom Perignon at a fancy disco; another was stopped driving a $59,000 Lotus sports car with $4,500 in cash; two others made down payments on new homes with $50,000 in cash.

It all began with petty shakedowns by the officers, according to affidavits and courtroom testimony. But the stakes quickly escalated. What investigators call "The Enterprise" grew into an alleged scheme to rip off drug dealers, sell drugs for profit and terrorize anyone who got in the way.

Then came the Big Score. One night early last summer, about a dozen police officers, wearing badges and blue uniforms, stormed a marina located a few miles from the heart of the city on the Miami River, according to affidavits and testimony. They allegedly left with 300 to 400 kilograms (660 to 880 pounds) of cocaine in the trunks of their squad cars. The cocaine had a street value of about $25,000 a kilogram.

On July 28, officers staged a similar raid at a boat yard on the same river, according to investigators. Again, officers took 300 to 400 kilograms of cocaine, worth from $7.5 million to $10 million, investigators say. But this time, three drug dealers drowned after jumping into the river to avoid the officers.

For months, there was no official word of what happened. Finally, two days after Christmas, the Metro Dade Police Department announced it had cracked the cases.

Six current or former Miami policemen were arrested for alleged racketeering and drug trafficking; three were charged with murder. All maintain they are innocent.

Last week, homicide Detective Alex Alvarez, the lead investigator in the case, faced the accused officers for two days in a tense bond hearing as parents, wives, girlfriends and television cameras looked on in the crowded courtroom.

Some of the city's best-known defense attorneys attacked police as putting together a weak case, based on no physical evidence. Attorney Jay Levine argued that the accused were being held only on the word of "lying, thieving cocaine dealers." Friends and family members testified to the character of the accused officers.

"There is strict law in my house," said Roberto Garcia, father of one of the accused. "In my house, no one smokes or drinks."

It was a made-for-television drama. The accused and the accuser are all Cuban-born Americans in their 20s, handsome, macho men -- one columnist called them "the beefcake cops" -- raised by working-class parents.

Until a few weeks ago, the accused were regarded as good cops. "You'd never look at these guys as bad apples," said Ray Lang, a spokesman for the Miami Police Department. "They are much-honored officers."

The officers joined the department in the aftermath of this city's 1980 racial riots and Mariel boatlift, when the number of Hispanic officers on the force almost tripled. Their new jobs represented a step up in pay and prestige.

Armando Estrada, 26, had been pumping gas; Osvaldo Coello, 25, and Armando (Scarface) Garcia, who bought a commerical bodybuilding gym as policemen, had been condominium security guards; Arturo De La Vega, 26, had worked at a bank; Roman Rodriguez, 29, was employed at a print shop; Rodolfo Arias, 26, had owned a gas station.

"It had always been his dream to be a police officer," Arias' wife, said. Arias was named "Officer of the Month" last July and was about to be named "Officer of the Year" before his arrest on charges of cocaine trafficking and racketeering.

De La Vega and Coello face similar charges. Estrada, Garcia and Rodriguez are also charged with first-degree murder in the drownings as well as drug trafficking and racketeering.

Police say the investigation is continuing and that other officers may be charged.

Controversy is nothing new to the Miami police. Eleven city officers were arrested or relieved of duty in 1985, and $150,000 was stolen from a safe at police headquarters. Two former officers were charged with trying to sell almost $2 million worth of cocaine seized by police in a drug bust last May. Two other officers were charged with selling badges, guns and equipment.

There are many here who blame the corruption on affirmative action programs, launched under pressure from the Justice Department and civil-rights groups. The force grew from 630 to 1,050 in three years; 80 percent of the new officers were Hispanics and blacks.

Kenneth Harms, the city police chief at the time, said standards were relaxed. "Instead of taking the cream off the top of the barrel, we were taking the whole damn barrel," he said. "Unfortunately, there were a number of fellows in that barrel that didn't deserve to be police officers."

Lt. Larry Martin, a homicide detective investigating the scandal, does not accept that argument. "These guys just succumbed to the temptations that a lot of officers are faced with every day. They saw an opportunity to make money and they did it.

Few places offer as much temptation for police as South Florida, where drug smuggling has grown into a major local industry. "Ordinary street policemen make arrests that we vice cops never dreamed of a few years ago," said Sgt. James Cox, president of the Miami Police Benevolent Association. "They find kilos of cocaine [while] arresting people on the street, and $100,000 in cars they stop speeding."

The accused officers were all uniformed patrolmen who worked together on the midnight shift.

The charges against the accused officers rest on statements by three witnesses with small-time criminal records and on tape recordings of meetings between the witnesses and three of the officers, investigators said.

The first incident of wrongdoing spelled out in dozens of affidavits in the case occurred Sept. 4, 1984, outside the Molino Rojo bar owned by Luis Rodriguez in the city's Little Havana section.

Patrolman Arias approached two men sitting near the bar and began searching them. Investigators believe Rodriguez had collaborated with Arias, setting the two men up.

Arias found a small amount of cocaine on one of the men and then searched a car where he allegedly found $16,000, according to affidavits. The men were arrested for drug possession, but police records show the $16,000 was never impounded.

The alleged rip-offs grew more ambitious, but there was never a formal plan, said Sgt. Al Singleton, one of the chief investigators. "It was just a group of police officers who got together when the opportunity arose."

Some of the officers wanted to quit after their first multimillion dollar job in early summer at the Tamiami Marina, according to investigators. But a few weeks later they apparently learned of another big cocaine shipment involving the same drug smuggler.

Pedro Martinez had smuggled a huge shipment of cocaine in the bowels of Mary C, a vessel supposedly undergoing repair at Jones Boatyard, according to a statement to investigators by Umberto D. Ulloa, Martinez's nephew.

Martinez, Ulloa told police, boasted about being "in charge of one of the largest cocaine operations in the United States . . . . He smuggled cocaine in steel-hull boats that were bought in Louisiana. These boats were mainly used for taking people to oil rigs and they made special compartments to smuggle cocaine in."

Martinez and five other men were allegedly loading the drug shipment into a van about 2 a.m., on July 28, when eight to 12 uniformed police officers came to the boat yard, according to a statement by Robert Anderson Downs, a security guard. "They said, 'We heard there's a boat load of dope in here, and they came right in.' "

Ulloa told investigators that another defendant in the case, Pedro Baez, later told him that his uncle had shouted to the men loading the van: "Stop, boys! Stop, fellas! It isn't the police. It's a rip-off." Martinez then jumped into the river.

"Kill 'em," one cop screamed, according to another witness.

The bodies of Martinez and two other men were found the next afternoon floating in the Miami River. All had drowned. There was no indication any of the police officers beat them up or pushed them in.

The deaths were classified as murders under Florida's felony murder law, which says anyone who causes the death of another while committing a felony can be charged with first-degree murder. Rodriguez's bullet-riddled body was found in a pine crate beside a road Aug. 1. No charges have been made in his death.