The Food and Drug Administration, under pressure from two consumer groups, has agreed to remove from the market over the next four years nearly 3,000 prescription medicines whose effectiveness has not been proven.

The agreement, reached last week, settles a lawsuit brought by the American Public Health Association and the National Council of Senior Citizens. William B. Schultz, counsel for the two groups, hailed the settlement as "an important comsumer victory."

While the suit specifically involved 422 medicines currently on the market, the settlement also covers an estimated 2,500 identical, similar or related products.

None of these nearly 3,000 preparatioons has been shown, by the "substantial evidence" required by federal law, to be effective for all of the medical conditions for which they are recommended by their manufacturers or suppliers. A small number, however, are effective in some of the uses for which they are promoted.

The 1984 deadline, if not delayed by further litigation, would mean that the last of these drugs would leave the market exactly 20 years after the original deadline set by Congress.

In 1979 alone, the public spent at least $1 billion for these drugs, according to Dr. Sidney M. Wolfe, director of the Health Research Group, which is financed by Ralph Nader's Public Citizen Inc. Wolfe cited data showing that physicians wrote 36.6 million prescriptions for just four of them, for a total outlay of $191.1 million.

The APHA and NCSC filed the lawsuit in 1970 to compel the commisioner of the FDA and his boss, the secretary of what is now the Department of Health and Human Services, to enforce the 1962 drug-effectiveness amendments to the Food, Drug and Cosmetic Act. The amendments required manufacturers to back up their claims of effectiveness by October 1964.

The litigation continued through the 1970s, during which time the FDA removed more than 7,000 drugs from the market. By 1979, 482 remained, and the agency said it regarded the program as "substantially completed."

In the same year, however, attorneys Schultz and Diane B. Cohn, both of Public Citizen's Public Litigation Group, filed a motion urging U.S. District Court Judge William B. Bryant "to reactivate the case because defendants are in violation of the deadlines established by the court . . . ."

In reply, an FDA spokesman said the agency was moving as swiftly as its resources permitted to resolve the status of the drugs about which efficacy questions remained.

Some of them were in "industry-requested administrative hearings, which require hearing examiners, lawyers and witnesses," while others were under "further testing," the spokesman said.

In the last 5 1/2 months, the FDA has hired three additional professional employes to speed the process, and, under yesterday's settlement, agreed to add five others.

In another key provision of the settlement, the FDA agreed to put "special emphasis on the most frequently prescribed products." of the 422 drugs of unproved effectiveness, 10 were on a list of the 100 most-often-prescribed medicines in 1978, including:

Dimetapp, an A. H. Robins cough syrup. In 1979, physicians wrote 14.8 million prescriptions for two versions of Dimetapp, costing comsumers $67 million.

Butazolidin Alka, a Geigy anti-arthritis drug (5.7 million prescriptions, $34.8 million).

A family of four Phenergan expectorants made by Wyeth (11 million prescriptions, $52.3 million).

Librax, a Roche mixture for digestive disorders (7.1 million prescriptions, $70 million).

Butazolidin Alka was among numerous multi-ingredient products rated ineffective as combinations, inasmuch as their manufacturers had not demonstrated them to be more effective than their components used alone. Such ratings were made initially by the National Academy of Sciences, which, under a 1966 contract with the FDA, assigned panels of independent scientists to evaluate the evidence of efficacy.

The Dimetapp, Phenergan and Librax products, which are also combinations, are sold under an exemption -- supposedly narrow -- to the court order. The same exemption, covering products designated "possibly" or "probably" effective in some or all of their recommended uses, has permitted uninterrupted sales of several other drugs on the list of the 100 most popular medicines, including Actified, Isordil, Mycolog, Ornade and Tuss-Ornade.

By the end of November, the agreement says, the FDA must send a bulletin to hundreds of thousands of health professionals listing the products covered by the court order that have not been upgraded to "effective" status. The bulletin must disclose that the products remain on sale pending the outcome of certain administrative proceedings.

Despite the agreement, the 1984 goal could be delayed by court challenges by pharmaceutical manufacturers.