Under threat of a veto from President Reagan, the House yesterday voted to keep the Legal Services Corp. alive for two more years, while cutting its budget by 25 percent and adopting severe restrictions on the kinds of cases the corporation can handle.

The 245-to-137 vote fell short of the two-thirds needed to override a veto, but it showed strong support in Congress for the program, which Reagan wants to abolish.

The last-ditch effort to send the bill back to committees to incorporate it into a state-administered block grant was defeated, despite a sudden administration pledge to add $100 million to the social service block grant proposal.

Opponents of the block-grant approach argued that in such a catch-all pool of funds the Legal Services Corp. would compete unsuccessfully with 11 other social services programs, all of whose budgets have been cut by 25 percent. However, the House cut back the Legal Services budget from the $260 million recommended by the Judiciary Committee to $241 million a year.

The federally funded corporation faces an uncertain fate in the Senate, where the Labor and Human Resources Committee has recommended a $100 million budget and the corporation's basic legislation has yet to be reauthorized.

The Legal Services Corp., an offshoot of the 1960s war on proverty, was established as an independent federally funded corporation in 1974 to provide attorneys for some 10 million poor people who cannot afford legal advice on matters such as divorce, wills, landlord-tenant disputes and other civil cases.

The most emotional moments of the day came in a bitter, two-hour debate over an amendment sponsored by Rep. Larry McDonald (D-Ga.) to prohibit Legal Services attorneys from representing homosexuals in discriminiation cases and other suits where their sexual preference becomes an issue. The amendment was approved, 281 to 124.

Although there was some dispute over its eventual interpretation, McDonald acknowledged that the amendment would mean that a person who was dismissed from his job because of alleged homosexuality and could not afford a lawyer could not be represented by Legal Services. He added, though, that it would not stop a homosexual from being defended on a traffic violation, so long as the question of homosexuality was not injected into the case.

Rep. Jim Leach (R-Iowa) charged that the amendment would "interfere with the ethical obligation of a lawyer to advocate all of his clients' legal rights." Rep. Gerry E. Studds (D-Mass.) called it "wrong, mean-spirited and unworthy of the members of this house," and urged his colleagues to have the "political courage" to vote against it.

A hush fell over the chamber when Wyche Fowler Jr. (D-Ga.) said, "Let us take the preposterous case that a member of Congress in a public building could be accused of homosexual conduct and that his partner was an indigent." Fowler noted that, unde the amendment, the member of Congress could afford a lawyer, while his partner, assuming the matter were a civil case, would not be entitled to one.

Fowler did not explicitly refer to the recent case of former representative Robert E. Bauman (R-Md.), who lost his seat after he was arrested in connection with an incident involving a teen-aged boy, or the case of John Hinson (R-Miss.), who resigned his seat after his arrest in a House office building restroom on a charge of attempted sodomy.

Maryland Democrats Michael D. Barnes and Steny Hoyer voted against the homosexual amendment and in favor of the final bill. Maryland Republican Marjorie S. Holt and Virginia Republicans Stanford E. (Stan) Parris and Frank R. Wolf voted in favor of the homosexual amendment and against final passage of the bill.

While the homosexual issue was being debated, the San Francisco Gay Men's Chorus, passing through town during a nine-city tour, was singing "Stout-Hearted Men" on the sunny West Front of the Capitol, to the appreciative glances of some tourists.

The House approved amendments to prohibit legal aid lawyers from fighting school desegregation cases and sharply restrict their representation of illegal aliens. However, it beat back an attempt to stop them from giving advice to women seeking abortions. The bill already precludes them from engaging in abortion-related lawsuits unless the woman's life is at stake.

An amendment to prohibit suits against local school boards or their employes also was defeated when opponents argued that it would prevent handicapped students from suing for the right to be educated.