Ethiopia broke diplomatic relations with Somalia yesterday, a move that could escalate the continuing fighting in the disputed border area into an all-out war.

Radio Addis Ababa, announcing the break, said all Somali diplomats had been ordered to leave the country within 48 hours. There was no immediate reaction from Somalia.

Although the two countries have had turbulent relations over conflicting territorial claims ever since Somalia became independent in 1960, they had never broken relations, not even during an earlier war in 1963-64.

The current fighting has been much more severe, however, with both the Ethiopian government and Somali guerrillas claiming to have inflicted thousands of casualities upon the enemy.

A diplomat, commenting on the Ethiopian move, said, "it's only amazing it took Ethiopia so long to break relations."

The Addis Ababa government has suffered serious losses in the disputed Ogaden territory in Southeastern Ethiopia, and diplomats here and in Africa have expected the hard-pressed government, also facing an insurrection in the north from Eritrean guerrillas, to launch a counterattack, possibly inside Somalia.

Analysts say there is a serious possibility that Ethiopia could time such an offensive for next Monday, the third anniversary of the military coup that overthrew the late Emperor Haile Selassie. A major celebration has been planned with much publicity.

Yesterday's Ethiopian annoucement of the diplomatic rift said that the government had "shown great patience" in the hope that Somalia would respect resolutions adopted last month by the Organization of African Unity calling for an end to the fighting. The broadcast added, however, that Somalia had "shown no respect" for the resolutions and "intended to pursue its aggression."

Hinting that it may carry the fighting to Somalia, Ethiopia said it had "exercised utmost self-restraint" in limiting its defense to its own territory.

Somalia has persistently denied Ethiopian charges that its regular troops are involved in the war maintainin that the fighting is being carried out by guerrillas of the Western Somalia Liberation Front. The Somali government does, however, claim large areas of Ethiopia and neighboring Kenya.

The fighting in the remote Ogaden territory has been marked by conflicting claims of victory by the two sides, the latest being over the strategic city of Jigjiga. Somalia says that Ethiopian forces control only two key cities, Dire Dawa and Harrar, the third-largest and fifth-largest in the country.

Another unknown factor is just how much foreign support the two governments are receiving.Ethiopia's Marxist military government broke more than a quarter century of close ties with the United States earlier this year and turned to the Soviet Union for supplies. There have been unconfirmed reports that hundreds of millions of dollars worth of Soviet military equipment has poured into Ethiopia this year.

The Soviet Union has long been Somalia's main ally and military supplier, but Mogadishu apparently fears a Kremlin cutoff and has appealed to the United States, China and moderate Arab for countries supplies.

At first Washington offered limited aid, but then it said it would not consider any arms shipments while the fighting in the Ogaden continued.

One indication of growing Soviet-Somali differences occurred last week, when President Mohammed Siad Barre visited the Soviet Union but did not see Soviet President and party leader Leonid Brezhnev. The visit ended with a coolly worded communique.

Yesterday in Iran, visiting Maj. Ahmed Mahmoud Farah, a high official in Somalia's ruling Socialist Revolutionary Party, charged that Moscow had stopped all aid to Somalia. He threatened that continuation of the cutoff would lead to expulsion of the approximately 5,000 Soviet military advisers in Somalia. There have been unconfirmed reports in recent months of some Soviet advisers' leaving.They had been serving as far down as company level, but the State Department has confirmed unofficially that there are no longer any Soviet advisers with Somali combat units.