Both houses of Congress are expected to act next week on a $3.9 billion drought aid compromise calling for a three-month dairy price-support increase but limiting feed assistance for livestock producers.

"The bill we have completed seeks to ensure the future for our farmers and ranchers," Senate Agriculture Committee Chairman Patrick J. Leahy, D-Vt., said Thursday night after a conference committee agreed to the measure.House Agriculture Committee Chairman E. "Kika" de la Garza, D-Texas, said floor action would come Thursday at the latest but that he would try for accelerated handling and final approval Monday or Tuesday.

Fast action also was expected in the Senate. Farm lawmakers in both houses were forecasting overwhelming approval.

President Reagan was expected to sign the bill. Its $3.9 billion price tag represents a steep cut from levels at which administration budget officials said lawmakers would start to flirt with nasty fiscal repercussions.

At the core of the measure is a feature that would pay farmers with 65 percent of lost earnings beyond 35 percent of the expected harvest. They would receive no payments for losses up to 35 percent of lost yield. Over that amount, however, they would be eligible for disaster aid equal to 65 percent of their losses.

Larger payments would be available for farmers severely hurt by the fierce heat and shortage of rain plaguing the nation's heartland.

The bill would furnish such producers with 90 percent of losses over 75 percent of their expected harvest. It represented a compromise between the 95 percent level the House approved and the 85 percent passed by the Senate.

Conferees fenced verbally without agreeing on much in sessions Thursday morning and early afternoon. Leahy and de la Garza finally went behind closed doors with top Republican members of the conference committee.

They emerged Thursday night with a compromise that was swiftly agreed to by other members of the conference committee.

The compromise jettisoned a Senate-passed provision that would provide government feed assistance to farmers who would not ordinarily be producing their own feed even if not for the drought.

Instead, the conferees opted for a House-passed provision that would provide assistance to livestock producers who also produce their own feed.