A bill making the first major changes since 1938 in the way the federal government regulates drugs has passed the Senate after five years of hearings.

Sponsored by Sen. Edward M. Kennedy (D-Mass.), the legislation has been branded a sellout to the drug companies by some consumer groups. But the drug industry says it doesn't like the bill, either. Meanwhile, Republican leaders, other consumer groups and the Carter administration, while maintaining there are still problems, give the legislation grudging approval approval and predict final passage sometime next year.

The bill passed the Senate unexpectedly Wednesday evening by a voice vote with only four senators on the floor. There was perfunctory discussion, even though the five years of hearings produced 38 volumes of testimony and heavy media coverage.

The style of passage led critics of the measure, like Ben Gordon of Ralph Nader's Health Research Group, to call the event "an absolute outrage. It's a very, very bad bill." atHe pointed out that Kennedy accepted 35 of 44 amendments offered by conservative Sen. Richard Schweiker (R-Pa.). "Kennedy was simply interested in getting a bill with his name on it through Congress as quickly as possible," Gordon charged. "The few good things in it are far outweighed by the bad."

The good things, a Research Group study said, include new authority for the Food and Drug Administration to require study of a drug's usage and side affects after it is marketed. No such authority exists now.

The FDA would also receive new flexibility in allowing a drug to be marketed for hospital use only, for example, while forbidding it for general distribution. Currently drugs must be approved for general use or not at all.

The bill would make it easier for the FDA to remove drugs from the market by requiring only the "imminent hazard" now needed. It would ban the giving of gifts and unsolicited free samples to doctors by drug companies, and afford the FDA subpoena powers it did not have before.

"On the whole we're fairly happy," said acting FDA Commissioner Sherwin Gardner. "It's a substantial contribution and improvement over the existing law."

He noted that some consumer groups had objected to a change requiring the FDA to show negligence on the part of drug executives before being allowed to prosecute, where previously the executives' liability was assumed. "We don't think that will result in significant difference in practice," Gardner said. "Where we presecuted before we will prosecute now."

Lewis Engman, president of the Pharmaceutical Manufacturers Association, the main industry trade group, issued a brief statement that said the bill "will adversely affect the American consumer . . . it fails to provide meaningful regulatory reform." He said it would slow down rather than speed up the approval process for new drugs. A PMA spokesman, Richard Hamilton, added that the proposal was "definitely an improvement over what it was last year, but not something we can support yet."

The fact there were no opposing votes on the Senate floor, or in the 13 to 0 vote to report the bill out of the Senate labor committee, meant only that the industry "is trying to take a constructive approach," Hamilton said.

Kennedy's committee staff chief, Larry Horowitz, said there was no opposition "because I don't think the industry felt they could win.:

"The Nader [Health Research] Group and the drug industry are opposed to this but the vast middle ground supports it," he said. "We consider it a major step forward."

Marcia Greenberger of the Center for Law and Social Policy objected to the so-called "breakthrough drug" provision that would allow new drugs to be marketed while their efficacy is still being tested, provided they met other requirements. Exports of drugs banned in America would also be permitted under certain conditions.

These are open to enormous abuse," she said.