House and Senate conferees reached broad agreement yesterday on a bill that would restructure several housing programs, shore up the ailing Federal Housing Administration and extend the life of low-interest mortgage programs that were set to expire.

The agreement, which came after weeks of wrangling between Department of Housing and Urban Development officials and House and Senate conferees, turned into a complicated effort to satisfy Senate Democrats who wanted to restructure HUD, House Republicans who wanted to protect landlords prevented from selling their properties and HUD Secretary Jack Kemp, who sought to use housing policy to achieve social goals.

In the end, all sides claimed victory and low-income housing advocates hailed the measure as an expansion of programs designed to house the poor.

Lawmakers struggled to the end over a compromise plan to salvage the Federal Housing Administration, which lost $4.2 billion in 1988 and has been described as fiscally unsound. Kemp had suggested increasing the amount borrowers must pay at closing and adding an additional insurance premium for riskier loans. The mortgage lending industry and consumers' groups had complained that Kemp's plan would unintentionally shrink the eligible pool of low- and middle-income buyers for whom FHA was designed.

A second proposal, sponsored by Reps. Bruce F. Vento (D-Minn.) and Thomas J. Ridge (R-Pa.), would have reduced the upfront cost that can be financed while adding a more modest insurance premium for all borrowers, a plan administration officials said would do too little to stanch the flood of losses at FHA.

Conferees agreed on a plan that more closely reflects a solution proposed by House Banking Committee Chairman Henry B. Gonzalez (D-Tex.) that gradually reduces the percentage of upfront premium that may be financed over three years, but assesses a .5 percent annual premium.

Under the plan, which won support from HUD and Ridge, but failed to satisfy Vento, about 57 percent of upfront closing costs could be financed and the buyer of a $65,000 home would pay about $3,639 in cash, about $800 more than the current average upfront cost.

Sen. Alan Cranston (D-Calif.), the chairman of the Senate conferees, praised the compromise, saying it "limited the number of people who will find it harder to come up with the down payment necessary" to own a home. But a spokeswoman for Consumers' Union called it a "bitter pill to swallow" that "creates new obstacles to homeownership that are simply unnecessary."

House and Senate conferees stressed that the final agreements will easily pass both houses. "Timing is never the problem," said Rep. Barney Frank (D-Mass.). "It's political will."

The agreement will also preserve public housing construction, which the Senate had threatened with elimination, by requiring local public housing authorities to incorporate any construction into any strategy that includes plans to encourage homeownership among public housing tenants.

The conference also agreed to strike a balance between the demands of low-income housing activists and the holders of expiring HUD mortgages. Under old law, landlords who hold the low-interest mortgages would have been permitted to sell their buildings after 20 years, presumably allowing rents to rise to reflect market rates.

Under the plan adopted by the conferees, owners wishing to sell would have to prove that HUD could not offer a sufficient incentive for them to keep the building for low-income tenants.