President Anastasio Somoza's successor refused today to turn over power as planned to a guerrill-backed government junta, throwing the country into confusion and sparking a new round of violence.

Somoza, who resigned early this morning and flew into exile in Miami, had relinquished power to Francisco Urcuyo Malianos. Urcuyo was to have ruled for only a few hours before the government backed by Sandinista rebels took over, completing the transition from the Somoza dynasty to the opposition that forced him from power.

Instead, while the five-member junta waited in neighboring Costa Rica to board a plane to carry them here, Urcuyo, 65, implied that he may remain in office until the end of Somoza's term in 1981. Urcuyo called for Sandinista guerrillas to lay down their arms and begin the "fraternal reconciliation of the country."

Astounded opposition leaders and U.S. diplomats spent the day in a frenzy of telephone calls to Costa Rica and talks with the Urcuyo government, which had not budged by nightfall.

In Washington, the State Department expressed "grave concern" that Urcuyo seemed to be seeking to remain in office. Any such attempt would contradict understandings reached with the Somoza government, the State Department said.

Junta spokesman Manuel Espinoza said in San Jose, Costa Rica, "If Urcuyo remains, he will be responsible for a bloodbath . . . He is playing with the blood of Nicaraguans."

U.S. Ambassador Lawrence Pezzullo visited Urcuyo briefly this afternoon in the office vacated only hours before by Somoza. On emerging he told reporters the visit had been "a courtesy." He refused further comment throughtout the day.

It was unclear whether Somoza had planned the whole affair to retain power from outside the country or whether Urcuyo himself, the former president of the Congressional Chamber of Deputies for Somoza's Liberal Party, decided to try to hang onto the presidency with the help of the National Guard.

The fact that something had gone awry was apparent early this morning when the new government cancelled a meeting of National Guard and Sandinista commanding officers scheduled to take place at the Nicaragua-Costa Rica border. At the same time, an order signed by new National Guard director Col. Federico Mejia and broadcast over the government radio told National Guard troops to "continue fighting the communists."

Heavy battles between the two forces were reported throughout the day in rebel-held Masaya, 20 miles south of here, in the northern city of Chinandega and other points throughout the country.

Residents of the guerrilla-occupied towns of Diriamba and Jinotega werw awakened at 3 a.m. by church bells announcing Somoza's resignation. Reporters on the scene said people ran through the streets singing and dancing while Sandinistas marched and shot their guns into the air.

Before noon, however, Managua was swept by rumors that Sandinista troops were marching on the capital from all directions to take the city by force.

The capital, nevertheless, remaines calm. National Guard soldiers had abandoned numerous roadblocks that had halted traffic to the city for weeks. There were no outward signs of celebration and most people seemed totally confused. Until the National Guard had left completely, many said, it made no difference that Somoza had gone.

Many interpreted today's dashed expectations and confusion as a sort of diabolical vengeance they should have anticipated from the 53-year-old former president who followed his father and older brother in a 45-year dynasty of family control they fear is not yet over.

After 18 months of sporadic insurrection, more than six weeks of devastating civil war and at least two of intense international negotiations with both Somoza and the junta, the events of the past 48 hours seem to have left many Nicaraguans more than a little dazed.

Under a plan painstakingly negotiated primarily by the United States talking with both Somoza and the junta, Somoza was expected to resign yesterday and turn the presidency over to a congressional successor who would then relinquish control to the junta, within a matter of hours.

The heads of the two warring armies would meet to negotiate a cease-fire and the structure of new joint force. By Sunday evening, the plan had gone largely according to schedule. A government order was issued retiring all National Guard officers with 30 or more years service. These were considered the most closely identified with the Somoza regime, and their departure from the country with Somoza was to leave control of the National Guard in the hands of younger, ostensibly more progressive officials.

Yesterday evening, members of Congress had gathered in the lobby of the Intercontinental Hotel, where they had been told the president would tender his resignation to them and they would elect Urcuyo.

About 8 p.m., Urcuyo telephoned a group of opposition leaders who were laying the groundwork for arrival of the junta. Sources said Urcuyo told them he had "no instructions to turn power over to anyone." The opposition leaders anxiously telephoned Pezzullo, who sources said told them to ignore what Urcuyo said because he was probably talking "with Somoza breathing over his shoulder."

The congressional meeting did not take place until 1:10 a.m. Somoza did not attend and there was no television speech. In a formal letter of resignation read to the Congress, Somoza said history would judge him and his fight against communism.

Amid lengthy applause, the newly elected Urcuyo left the closed session and told surprised reporters he thought he might remain in office as long as "one, two or three months." Most of the tired congressmen went to bed.

At approximately 4:45 a.m., a line of limousines left the darkened bunker and climbed a hill behind the compound to Somoza's house and helicopter pad. A few minutes later, a number of helicopters landed and quickly took off again.

They reportedly carried Somoza and approximately 45 others to the International Airport, where they took off in small jets for Homestead Air Force Base outside Miami. When Nicaragua awoke, the dictator was gone without even a last goodbye.

Then came daylight, the cancelled border meeting and the radio announcement, including the reading of Somoza's resignation letter.

At noon today, Urcuyo gave a 20 minute speech to the press and Liberal Party members. He spoke as if resignation was the last thing on his mind, calling for the country to begin applying "balm to the wounds of the war."

Urcuyo called on "the irregular forces to lay down their arms, not before anyone or to anyone, but on the altar of the country."

There was no further official word from the administration today. Urcuyo reportedly spent the afternoon inside the bunker with the members of the new National Guard chiefs of staff.

Washington Post staff writer Terri Shaw added from San Jose, Costa Rica :

Plans for a victorious return to Nicaragua by the guerrilla-backed provisional government and a bevy of high ranking Latin American diplomats were blocked when the airport here was informed by Nicaragua authorities that their plane would not be permitted to land in Managua.

Junta spokesman Espinoza said the junta would fly to someplace in Nicaragua soon.

It became apparent late last night in San Jose that the United States was being blamed for the breakdown in the plans for a transition of power to the new government.

Sources close to the junta and to the Latin American foreign ministers indicated that they would issue statements critical of the U.S. role.

A Sandinista spokesman said, "the United States has not kept its word."

A member of the crew of a plane that flew relief supplies to Managua today said the airport was still in control of Somoza's National Guard.

The long wait at the airport for the junta's decision on when to return to Nicaragua capped a day of jubiliation and confusion here.

The celebration of Somoza's downfall began at midnight with a cacaphony of sirens and automobile horns.

Young Costa Ricans and exiled Nicaraguans waved red-and-black Sandinista flags in downtown streets and lifted their clenched fists in the socialist salute. Costa Ricans leaving downtown nightclubs joined the cheers and many of the Nicaraguans living here cried and embraced upon hearing the news.

The sounds of celebration in San Jose's streets interrupted a meeting of the foreign ministers of the Andean Pact nations of South America with members of the junta at the Venezuelan ambassador's residence.

A diplomat who attended the meeting said an aide ran in with the news of Somoza's departure and those in the room cheered and applauded.

The Andean Pact foreign ministers - from Venezuela, Columbia, Ecuador, Bolivia and Peru - had arrived last Sunday at the request of the junta to witness and assist in the transfer of power in Nicaragua. High-ranking officials from Panama. Costa Rica, the Dominican Republic and Mexico had also accepted invitations to accompany the junta to Nicaragua.

Also here were the Archbishop of Managua Miguel Obando y Bravo and the head of the Nicaraguan Red Cross Ismael Reyes.

At the meeting, the three members of the junta in Costa Rica - Sergio Ramirez, Violeta Chamorro and Alfonso Robelo - repeated their request for help in the transition and invited the foreign ministers to accompany them on their triumphal return to Nicaragua.

The other two junta members are Daniel Ortega, who reportedly is in the northern city of Leon, and Moises Hassan, who is said to be in Masaya.

The five Andean Pact foreign ministers reportedly told the junta they would help the new government, but asked for assurances that the human rights of Somoza's supporters be respected.

Ambassador Andres Rosenthal, a special envoy of the Mexican government, also spoke at the meeting.

Panama, Costa Rica and the Dominican Republic also had accepted junta invitation to send high level delegations on the plane to Managua.

Before the stall by Urcuyo became apparent today, in the streets of San Jose there was a sense of relief and celebration.

Nicaraguans cheered, cried and hugged each other.

"It's such a wonderful feeling after 45 years of struggle" against the Somoza dynasty, said one young woman who worked in the junta's press office.

Alfonso Robelo, a member of the junta, said. "For us it is like the end of the nightmare the people have been suffering." CAPTION: Picture 1, Anastasio Somoza, center, speaks to reporters after arriving in Miami Beach. AP; Picture 2, Newly appointed President Franciso Urcuyo Malianos addresses the nation. UPI; Picture 3, Sandinista leader Commander Zero says the he expects the junta to take over soon. AP; Picture 4, Some Managuans give victory signs after learning of Somoza's resignation. UPI