Two years after the end of the United States hostage ordeal in Iran, mediated by Algeria, relations between Algiers and Washington have stabilized into a ''solid understanding,'' according to Western diplomats here.
The thaw, reflected in both diplomatic and commercial matters, ends years of tension that began when Algeria broke relations with the United States at the outbreak of the 1967 Middle East war. Relations were resumed in 1974, but were ''marked by major political differences over international issues,'' in the words of a US State Department publication.
The regularity of anti-American rhetoric in newspapers such as the semiofficial Moudjahid might suggest the fiercely Socialist government still has nothing but disdain for Washington, especially on Middle East policy. But behind the scenes, ''There is a good working relationship with regular, high-level contacts,'' a diplomat said.
In particular Algeria has begun to play a crucial role in conveying messages to regimes with which the US has no official ties. The 10th largest nation in the world is now generally viewed as a moderating influence on militant governments in Africa, the Arab world, and the nonaligned movement.
Diplomats claim that relations with the US have improved largely because of the pragmatism of President Chadli Benjedid, who has toned down the dogmatic approach of his predecessor, Houari Boumedienne.
This is reflected politically in a willingness to talk to the West in general , including reconciliation with is former colonial master, France. And economically, Mr. Benjedid has turned increasingly to the West, including the US , for models to rebuild Algeria's badly out-of-focus economy.
Strengthened ties with Washington were apparent in the trip last December by Secretary of Commerce Malcolm Baldrige, who led a ''trade and investment mission'' of 35 leading figures of major American companies. It was the first visit to Algeria by an American Cabinet official since 1974. The group met with Mr. Benjedid and one-third of his Cabinet.
Meanwhile, Algerian Foreign Minister Ahmed Taleb Ibrahimi has been to the US several times since he took office last April for discussions with Secretary of State George Shultz and Vice-President George Bush, envoys here said. In general , access is ''much better'' now for the Americans than for the Soviet Union, which is ideologically closer to the Algerians.
The diplomatic thaw has been matched by stronger trade ties, which are now many times greater than with the Soviet Union. An official US economic brief published in January said Algeria now ''offers excellent business prospects for US exporters.''
This is in part the result of a new investment code that encourages foreign firms to return to Algeria and that allows greater private-sector development in a previously strictly state-controlled economy. But it also is a function of a foreign policy that has begun to display ''a willingness to look wherever to get what Algeria needs, which is usually the West,'' one envoy explained.
In 1981, Lockheed announced the sale of 14 cargo planes to the Algerian Air Force, to be stretched over three years. A major contract for gas sales was finally settled last summer, after two years of talks, with a Texas firm.
In general, diplomats predict a ''consolidation'' of relations on both fronts over the next five years, in part because it is expected the current government will be re-elected in a year's time.