A $ 1.7 billion antidrug package swept through the House and Senate yesterday, climaxing a rapid election-year congressional response to national concern about illegal drugs.

The House approved the measure, 378 to 16, finally giving up its attempt to include a provision authorizing the death penalty in some drug-related murder cases.

The Senate, which twice had rejected the House-sponsored capital punishment section, passed the measure by voice vote. President Reagan is expected to sign the legislation.

"We won't win the war [against drugs] immediately, but we'll stop losing ground," Majority Leader James C. Wright Jr. (D-Tex.) said after the House cleared the measure.

In approving the bill, the House resorted to an unusual procedure to provide death-penalty advocates a third chance to go on record in favor of the death penalty. The measure, stripped of the capital punishment provision, was passed in a single vote that also approved a companion resolution authorizing the death penalty in drug-related murder cases.

Both were then sent to the Senate, which, as expected, passed only the drug legislation and will allow the capital punishment resolution to die with the 99th Congress.

"This bill allows us one more chance to tell the American people your will will be executed again by this body," said Rep. George W. Gekas (R-Pa.), the author of the death-penalty provision.

But Gekas, who two days ago said a drug bill without the death-penalty provision would be "simply throwing money at the problems" and a "wasted effort," voted for the bill, as did all other House Republicans. The 16 votes against the measure were cast by Democratic liberals who oppose capital punishment and objected to linking the bill to the death-penalty resolution.

The overwhelming approval of the measure was testimony to the powerful election-year forces that have been propelling Congress toward enactment of a major antidrug program since July. The drive to declare a national "war on drugs" was fueled by news reports on the spread of illegal drugs, particularly cocaine, into middle-class neighborhoods and schools and by the cocaine-related death in June of University of Maryland basketball star Len Bias.

While the congressional package will not eradicate the drug problem, Rep. Charles B. Rangel (R-N.Y.) said, "At least we can go home and tell our constituents that we tried."

The death penalty was the most contentious of several controversial provisions stripped from the bill by the Senate, including a relaxation of judicial rules against the use of illegally obtained evidence in court and a proposed massive deployment of U.S. military forces in drug-interdiction efforts.

In its final form, the measure authorizes a total of about $ 502 million in additional appropriations this fiscal year for the Coast Guard, Customs Service, Drug Enforcement Administration and other agencies involved in drug interdiction and law enforcement.

The bill includes additional funding for prison construction, international narcotics-control efforts and domestic drug-education and prevention programs, and it authorizes a total of $ 690 million over the next three years in grants to state and local law-enforcement agencies.

Under the legislation, criminal penalties for most drug offenses would be increased, although the bill contains no specific mandatory life imprisonment sentences.

The measure contains provisions dealing with money laundering, a national truck- and bus-driver licensing system and eligibility of the homeless for welfare benefits.