An economic and trade agreement signed in Baghdad this week by Syria Iraq marks another important step in the reconciliation of two old foes that has changed the balance of power in the Arab world.

After years of bitter, even violent, hostility, the governments in Baghdad and Syria show every sign of co-operating smoothly, especially in the foreign policy and inter-Arab affairs. Their reconciliation made possible the collective Arab decision to impose an economic and political boycott on President Anwar Sadat of Egypt because of his peace treaty with Isreal, and the two countries working together have achieved an Arab consensus that was never possible when they were pulling in opposite directions.

Syria and Iraq remain very different countries with contrasting styles of government, and they still are far from the unity they profess to seek. In recent visits to both countries, it was clear that Baghdad and Damascus have a long way to go before they can reunify their rival wings of the Arab Baath Socialist Party and that any talk of joint military action is at the least very premature.

Iraqi President Saddam Hussein, the most powerful man in the country, acknowledged as much after a visit to Damascus in February. He said it is "not possible to achieve unity without unity of the party," and he spoke only of "initial dialogue" and "initial familiarization" with each other's view.

Nevertheless, the two countries are cooperating in ways that would have been impossible only a short time ago. This has opened the way for key states like Saudi Arabia and Jordan to work with both of them in a united opposition to Sadat.

It would be difficult to overstate the importance in the Arab political context of the rapprochement between the Syrian government of President Hafez Assad and that of Hussein and President Ahmed Hassan Bakr in Iraq.

For years before Egypt and Isreal signed the Camp David agreements last September, Syria and Iraq were at sword's point, competing for the allegiance of other Arabs and seeking each other's downfall. After Sadat went to Jerusalem in 1977, the feud helped prevent his Arab opponents from agreeing on joint action against him. Their reconciliation, which astonished the Middle East, changed the regional political picture.

It began with a bolt-from-the-blue announcement by Assad last October that he would visit Iraq. That made possible the subsequent Baghdad conference that prepared the boycott of Egyptnow in effect and greatly increased pressure on Saudi Arabia to join it.

"It should not have been a surprise," Syrian Information Minister Ahmed Iskander said recently. "Arab feeling about the dangers of Isreal is greater than any differences over ideology."

Tarek Aziz, a member of Iraq's Revolutionary Command Council and a leading spokesman for the Iraqi wing of the Baath, said, "Because of regional developments, we decided to accept Syria as it is, and we built a new relaionship without referring to the past. It doesn't mean we have changed our idesa, but at a turning pointf of history, leaders should look to the future, not the past."

Officials in both countries said they have learned the lessons of the hasty and ill-considered mergers that litter the landscape of modern Arab history and we moving cautiously toward their union for that reason. As a result, they have agreed on economic cooperation, joint oil exploration, foreign policy and other issues. But they have not yet really tackled the two major points of difference - the Baath Party and the party's relationship with the Army.

An Eastern European diplomat in Baghdad who has been in the region 15 years said it is "impossible" for the two countries to achieve a joint approach on these matters. A western ambassador said the Syrians and Iraqis are "two different people, suspicious of each other, of different backgrounds. Fusion of the two parties would be very difficult, and they have problems at all levels: economic, military, government."

In the past, Iraq claimed to be the home of Baathist legitimacy - a claim fortified by the presence in Iraq of the party's Syrian founder, Michel Aflaq - and said the Syrian regime was a military dictatorship masquerading as a Baathist government. Iraq insisted on civilian party control of its armed forces and took a dim view of a Syrian government dominated by Assad's fellow Air Force Officers. These different approaches in turn inhibit military cooperation.

"The Syrian Army is highly politicized," a diplomatic observer said in Damascus. "It would be subversive to the Iraqis to have their army in contact with the Syrians. You have to change the whole military structure here, and that's very difficult."

This, he said, is why Iraqi troops have never moved up to Syria's confrontation line with Isreal on the Golan Heights and "they are even a long way from joint maneuvers."

Baghdad, a senior diplomat said union or join command in the military or police are out of the question because neither country trusts the other's approach.

"Over there," he said of Syria, "the military runs the country. Here only the party confers legitmacy. That is why there are no Iraqi troops on the Golan Heights, but they have still come a long way."

He said the Iraqis, despite a basic contempt and mistrust for Syria, have accepted the reconciliation because after Camp David, "they could see a step-by-step erosion of the extreme Arab position, one step at a time toward a settlement, and they wanted to block it."

Iraq and Syria jointly mediated between North and South Yemen in their recent border war and Iraq appears to be cooperating with Syrian policy in Lebanon. But they still have fundamentally different approaches to the question of Middle East peace.

Syria favors a negotiated settlement with Isreal, something Iraq traditionally has opposed. It is not clear whether good relations with Iraq would survive the test posed by some peace negotiations outside thvive the test posed by some peace negotiations outside the Camp David formula.