Turkey and Iraq, who fear the recent revolt by Kurds in Iran may spread to their countries, have agreed to cooperate in supressing Kurdish separatism in their border areas.

The agreement, Turkish sources said, was reached during talks in Baghdad Monday between Turkish Chief of Staff Gen. Kenan Evren and iraqi military leaders.

There has been small-scale fighting between Kurds and iraqi troops over the past three years, and Turkish security forces recently found large caches of arms, some reportedly of Soviet manufacture, in Kurdish strongholds in the southeast.

Turkish Prime Minister Bulent Ecevit said today that containing Kurdish separatism was one of the primary tasks of his government.

He charged attempts to disrupt Turkey's national unity were being made "both from within and from outside" the country and said his government would take all necessary steps to stamp them out.

About 10 million Kurds inhabit the mountainous wastes of southeast Turkey, northeast Iraq and southwest Iran. Backward, tribal and fiecely independent, the Kurds have been rising in uncoordinated revolt after revolt for nearly a century, only to be harshly supressed in turn, by the Arabs, Persians and Turks.

In 1920 the Treaty of Sevres recognized Kurdish statehood, but its terms were never carried out. The short-lived Kurdish republic of Mahabad in Iran in the 1940s fared no better. And their last major uprising in Iraq collapsed in 1975 when the shah of Iran, who had been supporting them against Baghdad, made peace with the government of Iraqi President Ahmed Hassan Bakr and cut off supplies to the Kurds.

The Kurds' national motto is "Have No Friends."

Nevertheless, the brief uprising in Sanandaj last month, which forced the new Iranian government to make major concessions to Kurdish autonomy, has sparked a new wave of Kurdish nationalism in the Middle East.

Kurdish rebel leader Celal Talabani says events in Iran mean his Pesh Merga (Forward Unto Death) guerrillas can now concentrate all their efforts against Baghdad.

"The downfall of the shah has liberated our forces from one front," the 45-year-old lawyer said in a statement reportedly taped at his mountain stronghold in Sulaimaniya, northeast Iraq, this month, and smuggled to Turkey.

It would also encourage Kurds deported to southern Iraq after the collapse of the 1975 revolt to rise again against Baghdad, Talabani said.

A self-claimed Marxist, Talabani claims to have 1,500 fighting men under his command.

A Turkish journalist who recently visited their Sulaimaniya headquarters said that they were armed with Soviet-made automatic weapons and artillery.

Turkish Sen. Kamran Inan, himself a Kurd, charges that the Soviets are fomenting unrest among the Kurds.

"Their aim is to set up a pro-Moscow Kurdistan state," says Inan.

Soviet sources deny they are supporting the Kurds and recall that the American CIA supplied the Kurds with East European-made weapons during the 1975 rebellion.

Concern over Kurdish separatism is deep in Turkey, where more than half of the 10 million Kurds live. Turkey's total population is about 42 million.

Since the Kurds revolted against the infant republican government of Kemal Ataturk in 1925 the Turks have been acutely nervous of armed Kurdish dissent.

The Kurdish issue has even penetrated domestic politics here.

Six independent Cabinet ministers, on whom Ecevit's Republic Peoples' Party depends for its majority in parliament, have indirectly accused a minister belonging to the party of supporting Kurdish aspirations.

The split in the Ecevit government was patched up only after a 17-hour Cabinet meeting yesterday.

After the meeting Ecevit promised economic relief for the largely under-developed Kurdish regions of southeast Turkey. Yet, with Turkey's current economic difficulties, it may be difficult to fulfill this pledge.* CAPTION: Picture 1, BULENT ECEVIT; Picture 2, AHMED HASSAN BAKR