President Reagan told Republican congressional leaders yesterday that he will veto legislation needed to implement his $30.2 billion deficit-reduction agreement with Congress unless lawmakers bow to his demands on giving new humanitarian aid to the Nicaraguan contras and other items.

Reagan told the GOP leaders that he will veto the legislation if it does not include a provision adopted by the Senate that would provide the rebels with another $16 million in nonlethal aid through the end of February and permit the aid to finance delivery of previously authorized military assistance.

The president also said he would veto the measure if it includes language enacting into law a fairness doctrine requiring broadcasters to air differing views on controversial issues. Reagan earlier this year vetoed similar legislation.

Despite meeting until 10 last night, congressional negotiators failed to agree on either the contra aid or fairness doctrine issues.

Republican leaders who met with Reagan said the president was not bluffing in his threats to veto the measures. "I think he's serious," said Senate Minority Leader Robert J. Dole (R-Kan.).

Key Democrats said they would not be swayed by Reagan's threat. House Majority Whip Tony Coelho (D-Calif.) said, "If the president wants to shut down the government to destroy the Central American peace process, that's his prerogative, but the American people want the government to keep functioning and the peace process to continue."

The president issued the veto threats as congressional negotiators pushed to reach agreements on the two pieces of legislation needed to complete terms of the Nov. 20 budget accord. The first is a $600 billion catchall spending bill, called a continuing resolution, that funds most government operations through the end of next September. It would cut the deficit by $7.6 billion through reductions in military and domestic spending. The second measure, called a reconciliation bill, combines a $9 billion tax increase with further spending reductions in permanent programs such as Medicare and farm subsidies, asset sales and user fees to achieve another $23 billion in deficit reduction.

As they met throughout the day in numerous small groups, lawmakers faced two deadlines: the Christmas holiday and the expiration at midnight last night of a previous short-term omnibus spending bill. Unless an agreement on the new legislation is reached by Monday morning, the government would be forced to shut down.

The Office of Management and Budget yesterday issued a memo directing that preparations be made for a government shutdown if the bills were not completed by the midnight deadline.

The full effects of a shutdown would not be felt until Monday, but the National Park Service said that, if necessary, it would close three Washington symbols later today -- the Washington Monument and the Lincoln and Jefferson memorials.

Meeting into the night, the conference committee on the omnibus spending bill failed to reach a compromise on the contra aid issue, as the Senate stuck to its $16 million offer and the House refused to go beyond a $5.5 million offer that included a prohibition on further military aid deliveries after Jan. 1.

The conference, finishing all but those two issues, tentatively decided to leave the fairness doctrine provision in the bill, but left open the possibility of removing it later, perhaps as part of a deal on contra aid.

Earlier, House Speaker Jim Wright (D-Tex.), alluding to strong Democratic opposition to further assistance to the Nicaraguan rebels, had said the $5.5 million compromise would be "better than nothing" for the White House.

Republican leaders who met with Reagan yesterday said the president also has less vehement objections to a number of other provisions in the deficit reduction legislation, including the refinancing of $5 billion in rural electric loans and some measures designed to produce savings in federal medical programs.

Congressional negotiators were close last night to a deal on the rural electric loans that would reduce the refinancing to $2.5 billion, a level acceptable to the administration.

The GOP lawmakers who went to the White House yesterday said they urged Reagan to stand fast in his opposition. "Otherwise {Democrats} will run right over him in the final year," said House Minority Leader Robert H. Michel (R-Ill.).

Even with the threat of a government stalemate, however, congressional negotiators made some progress in resolving their own differences over the two bills. Since late Thursday night the wide-ranging talks have: Produced an agreement late Thursday on the $9 billion tax increase, which is aimed mostly at corporations and wealthy individuals. The package is expected to incite little opposition, although the administration opposes an obscure provision placing a new tax on vaccines used in child-inoculation programs. {Details, Page C1.}

Resolved disagreements over how to produce close to $1 billion savings in agricultural programs.

Agreed to bar Japanese construction firms from participating in all federally funded public works projects unless Japan opens its own market to U.S. construction firms.

Banned smoking on domestic airline flights of two hours or less.

Still unresolved as of last night were a number of nettlesome questions in addition to the contra aid and fairness doctrine issues. They include:

How to achieve about $850 million in savings from Postal Service operations. Office of Management and Budget Director James C. Miller III contended yesterday that the House proposal, which would place the Postal Service outside the official budget, was "a complete violation of the bipartisan budget agreement."

Disagreements over how to reconcile bills cutting Medicare, Medicaid and income-security programs. The Office of Management and Budget continued to insist that new spending in the House Medicaid package would increase the federal deficit in 1990 and 1991. And House Ways and Means Committee Chairman Dan Rostenkowski (D-Ill.) and Senate Finance Committee Chairman Lloyd Bentsen (D-Tex.) were still divided over how to allocate Medicare reimbursements to hospitals in their home states.

With much of Congress' work for the entire year crammed into two huge bills being considered hastily in the final week, lawmakers have been afforded unusually fertile opportunities to affect public policy on issues both grand and trivial.

The two conference committees debating the huge appropriations bill and its companion reconciliation measure have been the battlegrounds for a wide range of issues including reviving the Midgetman missile, restoring foreign aid to Pakistan and providing $500,000 for the Seattle Goodwill Games and $8.5 million for a proton-beam cancer treatment center at the Loma Linda University Medical Center in San Diego. Senators even won a provision that will allow them to give senior aides a pay hike that is unavailable to House senior staffers.

And in at least one case, lawmakers on one side of a controversy have tried to use one of the bills to negate policy set in favor of the other.

That occurred yesterday, when Rep. James J. Howard (D-N.J.), chairman of the House Public Works and Transportation Committee, tried to use an obscure sub-conference of the reconciliation bill dealing with the Tennessee Valley Authority to stymie an expansion of the 65 mile-per-hour speed limit agreed to by the conference committee on the continuing resolution bill.

The appropriations bill conference agreed Thursday night to language permitting 20 states to raise their speed limits on limited-access, four-lane roads in rural areas.

But Howard, working through the reconciliation sub-conference, sought a provision that would not allow the expansion unless those states can show that the death rates on rural interstates that already have the 65 limit have not risen. In most cases, that would nullify the expansion, as a federal report on Thursday showed that fatalities increased by 50 percent in 22 states that have raised their speed limits.

Howard also tried to use both bills to enact a significant change in the federal law that controls the removal of billboards along rural roads. The amendment would change the Highway Beautification Act so that the federal government would have to pay compensation when local governments require a reduction in the size of billboards.

Because there is virtually no money left in the federal compensation account, the Howard amendment would in effect prevent local governments from requiring billboard owners to reduce the size of their existing outdoor advertising signs.

Howard tried but failed to effect the change earlier this year. This week, he tried again on the continuing resolution, and was rebuffed a second time. Yesterday, he was working to include it in reconciliation through the TVA sub-conference.

Howard, who according to one anti-billboard group received more than $55,000 in campaign contributions and honoraria from billboard interests during 1985 and 1986, said the change is "just a clarification." But Ed McMahon of the Coalition for Scenic Beauty, a group that fights to eliminate billboards, termed it "an example of special-interest politics at its worst." Staff writers Spencer Rich and Anne Swardson contributed to this report.