President Reagan, pledging that "we will not abandon our friends in Central America," said yesterday that the United States should continue providing military aid to the Nicaraguan rebels if the pending Central American peace plan collapses.

"We will not accept a mere semblance of democracy," Reagan said. "We got to this point through the efforts of the over 15,000 freedom fighters in struggling, and some of them dying, for the freedom of their country . . . . And if the recent peace agreement does not work, let's resolve that they will be able to count on our continuing assistance until Nicaragua is a genuine democracy."

The president said this "genuine democracy" must include a guarantee of amnesty for the contras opposing Nicaragua's leftist Sandinista government and "a firm date for free, contested and internationally supervised national elections and the immediate recognition of fundamental human rights" including freedom of speech, press and worship.

Reagan's appeal for the contras was the emotional highlight of a speech in which he vowed to end his term strongly and challenged Congress to end "the yearly budget fiasco" and approve several long-stalled administration initiatives.

The president said he gives particular priority to confirmation of Supreme Court nominee Robert H. Bork, who he said had been unjustly maligned as "some kind of a right-wing ideologue."

The president outlined the agenda for the balance of his term in a 13-minute pep talk in the East Room to high-ranking political appointees, including Secretary of State George P. Shultz and Attorney General Edwin Meese III.

Reagan's delivery was at times unusually halting, and he appeared to lose his place in the speech several times. At one point, he said his administration has "more than six years behind us and just six more months to come."

White House spokesman Marlin Fitzwater, asked whether Reagan is finding it difficult to adjust to his White House work routine after a 25-day California vacation, said, "He was into it by the end of his speech."

At that point, Reagan had begun talking about the contras with evident emotion. He said that "in recent weeks, the issue in Central America seems at times to have become confused . . . but the real issue has never changed. The real issue is peace and democracy in Central America and the national security of the United States."

Reagan quoted Costa Rican President Oscar Arias, author of the Central American peace proposal, as saying that peace will not come in the region until Nicaragua achieves "true democracy."

Fitzwater said after the speech that Arias and Reagan will meet Sept. 22, a day after Reagan returns from a speech to the U.N. General Assembly. Arias will be here to consult with House Majority Leader Jim Wright (D-Tex.) and other congressional leaders.

The president was applauded twice during the speech by the handpicked audience, once for his promise of support for the contras and the other for his backing for Bork, who has been depicted by critics as a right-wing activist who would upset the high court's balance.

Reagan said Bork "believes in judicial restraint," which the president said "means reading laws in the way intended by elected officials . . . and not reshaping them according to judicial whim." He quoted Bork as saying that "the moral content of the law" must come from its framers and not the morality of judges interpreting it.

"So consider the irony," Reagan said. "Some legislators are organizing opposition to a judge who believes in deferring to them and in faithfully abiding by the intent of the laws they pass. The country wants and deserves a Supreme Court that doesn't make the laws, but interprets the laws."

Reagan predicted that Bork, whom he called "a judge's judge and a people's judge," will be confirmed by the Senate, "but there's no denying it's going to be a tough fight."

White House chief of staff Howard H. Baker Jr., evaluating the confirmation battle, said last week that a majority of senators are undecided and awaiting Bork's testimony. Baker also said he thinks that Bork will be confirmed.