Soviet forces in Afghanistan have killed more than 3,000 people since 1979 by using chemical warfare, and hundreds more died in recent "savage" air and artillery attacks on two Afghan cities, Deputy Secretary of State Walter J. Stoessel Jr. charged yesterday.

Testifying before the Senate Foreign Relations Committee, Stoessel characterized the chemical warfare as "a particularly heinous aspect of Soviet military actions" and noted that "use of chemical weapons in war is a violation of the 1925 Geneva protocol, to which the U.S.S.R. is a party, and the rules of customary law, which apply to all nations."

Yet, he contended, 3,042 people died in 47 incidents involving chemical attacks between 1979 and last summer. "Analysis of all the information available leads us to conclude that attacks have been conducted with irritants, incapacitants, nerve agents, phosgene oxime and perhaps mycotoxins, mustard, lewisite and toxic smoke," he said.

Since Soviet forces invaded Afghanistan in December 1979, the United States has charged several times that the Soviets were using chemical warfare against Afghan insurgent forces. However, the testimony yesterday by Stoessel and other State Department officials was the most detailed that U.S. officials have given publicly.

Stoessel said the information had been collected from Afghan military defectors, refugee reports and analysis of recorded military operations. "This is very reliable information about a very serious situation," he said, adding that, although the United States has raised the issue several times with Soviet officials, they "deny they are engaging in this kind of activity."

In the more than two years since the invasion, Stoessel said, "thousands of innocent civilians have been killed or maimed as the Soviets and the puppet Afghan army have destroyed villages and crops, strewn anti-personnel mines over trails and inhabited areas, employed lethal chemical weapons and forcibly impressed young Afghans in the armed forces."

Only recently, Stoessel continued, "savage" Soviet artillery and aerial bombardment, followed by "wanton looting and killing," took hundreds of lives in attacks against two of Afghanistan's largest cities, Kandahar and Herat.

The effects of Soviet oppression, Stoessel said, have caused about 3 million Afghans--"almost one-fifth of the pre-invasion population"--to flee the country, principally for neighboring Pakistan. "The largest group of refugees in the world has so voted with its feet," he added.

Because of inability to quell the Afghan resistance, Stoessel said, the Soviets have been forced to pour more and more troops into the Southwest Asian country. He estimated that "when at full strength" the Soviets may have as many as 100,000 troops there, although "their actual presence varies from day to day."

He put the number of Soviet casualties at between 10,000 and 15,000, but did not give a breakdown of dead and wounded.

The administration's tough attack on Soviet actions in Afghanistan, a subject that largely has faded from the headlines in recent months, was intended partly to focus attention on President Reagan's plan to sign on Wednesday a proclamation designating March 21 as "Afghanistan Day." Stoessel said the president has asked former secretary of state William P. Rogers to coordinate the observances.