The House of Representatives, responding to a nationwide lobbying campaign by local police and firefighter groups, overwhelmingly voted yesterday to block the District government from using a lottery to hire new police and firefighters.

The lopsided 305-96 vote against the lottery, which city officials recently announced to attain racial balance in the police department, was followed within minutes by the voice-vote passage of another amendment that would temporarily block the city from trucking its sewage sludge to a landfill in Pennsylvania.

The back-to-back actions were the latest examples of what city officials say is increasing congressional involvement in District affairs, reminiscent of prehome-rule government in the nation's capital.

"It's part of the whole antigovernment mood out there," said a disappointed Del. Walter E. Fauntroy (D-D.C.). "The members here are taking more of an interest in the kind of District government decisions that anywhere else would be handled by the City Council."

The prime movers behind yesterday's vote on the lottery appeared to be the city's police and firefighters, who bitterly criticized Mayor Marion Barry last month when he announced that the District would hire 200 new policemen through a drawing of lots. Most of the top 200 scorers on a police recruitment examination were white, but, in order to increase the number of eligible blacks and women, the city has begun choosing the new candidates from a pool of 635 applicants who passed the test.

The police and firefighter organizations, charging that the plan would dangerously lower standards in the police and fire departments, immediately took their complaints to Rep. Stan Parris (R-Va.). Parris offered yesterday's amendment blocking the lottery to a $1.8 billion District appropriations bill, which the House approved without substantial reductions.

The unions also began contacting affiliated groups around the country, urging them to write and call their congressmen to support the Parris amendment.

"We sent out calls all over the country, telling our members that if they can start something like this here, no telling how fast it's going to spread," said Tommie Tague, president of the city's Fraternal Order of Police."

During yesterday's hour-long debate, Parris said the amendment is needed because the District's personnel policies "are systematically stripping the city of the qualified manpower needed to maintain adequate public safety."

But Rep. Julian Dixon (D-Calif.), chairman of the D.C. appropriations subcommittee, flatly predicted a lawsuit from minority applicants if the city is unable to proceed with the lottery plan to correct racial imbalances in the police department.

Police Chief Maurice T. Turner has already chosen the first candidates to fill the 200 slots at a drawing ceremony, and the city is now in the process of giving physical exams and conducting background investigations on the initial 30 applicants selected.

Parris, who said he was "reasonably confident" that his amendment will be sustained when the appropriations bill goes to the Senate, insisted that it will prohibit the city from filling the remaining 170 police slots from the applicants selected by lot.

The sludge amendment, offered by Rep. James Coyne (R-Pa.), may also create difficulties for District officials. The city, under court order to have a new plan for the removal of its sewage sludge in place by Oct. 15, recently signed a contract with a Beltsville firm to truck 500 tons of sludge per day to a landfill in Bucks County, Pa.

But Coyne's amendment bars the city from transporting any sludge to another state until Dec. 1 to give Pennsylvania environmental authorities time to review the plan. "We wanted to get more back from Washington for our congressional district, but sludge isn't what we had in mind," said Coyne.

The appropriations bill also eliminates all funding for a gambling lottery and daily numbers game that was approved by city voters in an initiative last fall.

"A lottery . . . would be offensive to many people who come here from around the country and regard this as their city, too," said Rep. Lawrence Coughlin (R-Pa.), ranking minority member on the D.C. subcommittee. "We want the city to have as much home rule as possible, but where that impinges on the rights of all Americans, then Congress is required to act."