The top political leader of El Salvador's rebel movement and a high-ranking Salvadoran government official have agreed to a public debate next month in Los Angeles on ways to end the country's civil war.

The debate, organized for Oct. 12 by the Center for the Study of Democratic Institutions of Santa Barbara, Calif., would be the first known contact at such a level since the bloody conflict began more than four years ago.

Minister of the Presidency Julio Adolfo Rey Prendes said today be plans to take part in the debate as representative of President Jose Napoleon Duarte's Christian Democratic Party. He said only a public debate has been scheduled, with no plans for secret contacts on the side. In what seemed to underline the potential of the event, however, he also raised the possibility that a more substantial dialogue could grow from the encounter.

"We do not know if from there it will be possible to derive a dialogue or not, if from there it will be possible to derive a series of proposals," he said on a Salvadoran radio station. "This could be seen afterward. But it is indeed an indisputable demonstration of good will by the government and the Salvadoran political forces for this meeting."

Rey Prendes said his main opponent would be Guillermo Ungo, chief of the Revolutionary Democratic Front, the political arm of the rebel forces. A third participant would represent the Nationalist Republican Alliance, or Arena, the main right-wing party. Its presidential candidate, Roberto D'Aubuisson, was defeated by Duarte last spring.

Allen Weinstein, president of the center in Santa Barbara, which is associated with the University of California, said he and his colleagues arranged the debate last month during discussions here with Duarte and in Mexico City with Ungo. The gathering was designed as an all-day seminar with participants to include U.S. policy makers, Rey Prendes, Ungo and an Arena representative, he explained.

"After which, they're in the same city and the same hotel and they can do what they want to," he added by telephone from Santa Barbara. Weinstein said he has agreement from Ungo to attend and received the impression from discussions with State Department and National Security Council officials that Ungo will get a U.S. visa for that purpose.

The rebel leader has been refused authorization to enter the United States recently, with Reagan administration officials citing his fund-raising on behalf of the Farabundo Marti National Liberation Front guerrilla groups.

A State Department spokeswoman said that if an application is received "it will be considered in light of the purpose of his visit."

The idea of dialogue between the Salvador government and the guerrilla movement has been sensitive here for some time. Duarte promised during his election campaign to seek contacts as a way to end the fighting. But since his inauguration June 1, he has put off the idea in an apparent effort to avoid ruffling the Salvador officer corps and right-wing political forces.

The Reagan administration has contended that any dialogue with the Nicaraguan-backed rebel movement should be designed only to bring the leftists into government-organized elections. It has rejected rebel demands for negotiations to form a new government that would run the country pending new elections.

Against that background, Duarte's decision to send Rey Prendes, his top political lieutenant, to a public appearance with Ungo marked something of a departure from the president's first three months of caution.

Rey Prendes' use of the word "dialogue," even in speculation, and his use of the term, "political forces" to include rebel leaders as well as the right, also seemed unusual for the same reason.

Perhaps as a result of this, Rey Prendes abruptly canceled a news conference this afternoon during which he was to explain further the plans for his appearance with Ungo.

Previous efforts to establish contacts have included U.S.-arranged meetings of rebel leaders with the Salvadoran government's Human Rights Commission.

These gatherings came to nothing and were suspended last year. More recent contacts have taken place through mediation by the Salvadoran Roman Catholic Church, including prolonged indirect negotiations between the Army and guerrillas that led to release May 10 of Col. Adolfo Castillo. The former deputy defense minister, who spent two years as a prisoner, was exchanged for seven guerrilla captives.

A high-ranking Salvadoran military officer said Archbishop Arturo Rivera y Damas also arranged an unannounced exchange last week of lower-ranking prisoners from both sides. A rebel said recently that Army officers appear more willing to engage in such practical contacts with the guerrillas than Duarte does to allow political discussions.

President Luis Alberto Monge of Costa Rica had hoped to foster such talks soon after Duarte's election but, the rebel said, Duarte has resisted attempts to organize contacts.