ALBANY, N.Y. (AP) _ New York's highest court has cleared the way to try billions of dollars in lawsuits over the anti-miscarriage drug DES, and a lawyer said a long legal fight was just beginning.

''We have a long ways to go,'' said New York City attorney Paul Rheingold, who represents several women who claim they were harmed by the drug in their mother's womb. ''But at least the way's been cleared for the 500 women who've filed suits to have their day in court.''

The Court of Appeals on Tuesday unanimously upheld the state's toxic tort law, under which the women filed their lawsuits. The court also ruled that all companies that made DES for use by pregnant women should be liable for a percentage of any damage awards won by New Yorkers - even companies that never marketed their pills in the state.

The ruling, written by Chief Judge Sol Wachtler, drew praise from women who claim they were harmed by the DES their mothers took between the late 1940s and early 1970s.

But Jay Mayesh, a lawyer for Upjohn, one of the major drug manufacturers involved in the suits, cautioned that the justices addressed only procedural issues.

''They do not address the fundamental question of whether DES caused any of the health problems the plaintiffs claim it did. That issue remains very hotly contested,'' he said.

Mayesh said drug company attorneys, from their experiences in other state courts, have become very good at showing that DES may not be responsible for the maladies blamed on it.

The drug has been cited for allegedly causing a range of serious health problems in the offspring of women who took it, including cancer, miscarriages and sterility.

In virtually every case, victims were barred from suing because their health problems didn't appear until years after the statute of limitations had expired.

The toxic tort statute opened a one-year period for people to file suits for damages they claim were caused by exposure to one of five substances, including diethylstilbestrol, or DES. The other substances named in the law are asbestos, tungsten-carbide, chlordane and polyvinylchloride .

More than 500 DES suits seeking some $3 billion in damages were filed between July 1986 and July 1987 under the statute.

In Wachtler's ruling, the Court of Appeals rejected contentions made by drug companies that the toxic tort statute violated their constitutional rights to due process and equal protection. The companies had claimed the law unfairly singled out just five substances.

A stickier legal question for the court, apparently, was how to determine which drug companies were responsible for damages and how much they should pay.

The court decided unanimously that a ''market share theory,'' similar to one first formulated by California's top court, would be adopted in New York for apportioning damages from the DES litigation.

That means drug companies will be liable for the percentage of damages in New York court cases corresponding to the percentage of the national DES market they controlled while manufacturing the drug.