The House yesterday passed legislation authorizing $873 million in grants this year to states, cities and health care providers to help stem the spread of AIDS.

Adoption of the legislation on a 408 to 14 vote came after the House defeated attempts to require states to conduct mandatory AIDS testing and to require that the names of individuals who test positive for the AIDS virus be reported to health officials.

The bill, similar to a measure adopted last month by the Senate, authorizes $275 million this year in emergency grants to 15 cities hardest hit by the AIDS epidemic, including the District. How much of the funds authorized by the bill will actually be appropriated will depend on decisions later this year by congressional spending committees.

Much of the spending authorized by the House measure would go for preventive health services, such as AIDS testing and counseling, and for early drug treatments for people infected with the AIDS virus.

Proponents of the measure said massive federal help is urgently needed to permit overburdened health care facilities to cope with what Rep. Henry A. Waxman (D-Calif.) called a "tidal wave" of AIDS cases.

Despite overwhelming support for the AIDS prevention legislation in Congress, the administration said it is opposed to the House measure because of what the White House budget office has called the

bill's "narrow disease-specific approach."

Much of yesterday's House debate centered on a proposal by Rep. William E. Dannemeyer (R-Calif.) that would have prevented states from receiving grants unless they require the confidential reporting to health officials of the names of individuals infected with the human immunodeficiency virus (HIV), which causes AIDS.

"We federal taxpayers are being asked to pony up about $4 billion to fight this epidemic this year," said Dannemeyer. "We have the right to ask those who are HIV carriers to be accountable to the public health system."

By a vote of 312 to 113, the House gutted Dannemeyer's amendment by leaving it up to the states to decide whether to adopt such a reporting requirement.

In addition to the grants to large cities affected most heavily by the AIDS epidemic, the legislation authorizes $400 million in grants to state governments and health care facilities for AIDS preventive services. It also would set up grant programs to certain hospitals, prisons and pediatric AIDS programs.