Zimbabwean Prime Minister Robert Mugabe said today that he and Soviet leaders had discussed the possibility of Soviet military aid to buttress his country against threats from South Africa.

Mugabe, concluding two days of talks with Soviet leader Mikhail Gorbachev and other senior Kremlin officials, said his visit assisted in "cementing" Soviet-Zimbabwean relations.

"We talked about our own military capability," the Zimbabwean leader said in a news conference, "and how we can strengthen ourselves in the face of threats from South Africa." Mugabe added that military aid had been discussed, "but if agreements are going to be reached, they have to be worked out by specific people."

He indicated that Soviet officials would be visiting Zimbabwe early next year.

Mugabe's comments, just days after South Africa warned that it might send troops into Zimbabwe, appeared likely to sharpen tensions between the two southern African countries and to heighten the international aspect of the conflict.

Last week South Africa hinted that it might dispatch troops to Zimbabwe in search of suspected insurgents after land-mine explosions wrecked vehicles in a South African military area near the Zimbabwean border.

In Kremlin meetings yesterday between Nikolai Ryzhkov, chairman of the Council of Ministers, Mugabe and other officials from the two countries, "special attention was paid to the situation in southern Africa," according to the Soviet news agency Tass.

Sergei Akhromeyev, chief of staff of the Soviet armed forces, and Ernest Kadungure, Zimbabwe's minister of state for defense, also took part in the discussions.

Zimbabwe now receives some Soviet military assistance, according to western sources.

In a speech following the Monday meetings, Ryzhkov blasted the South African government, saying, "Whatever brutalities the racists may perpetrate, the day is not far off when the struggle of the people of Namibia will be crowned with victory." Namibia, or South-West Africa, is ruled by South Africa in defiance of U.N. resolutions.

Mugabe met for several hours today with Gorbachev and Andrei Gromyko, Soviet head of state.

The visit was his first to the Soviet Union since he became leader of Zimbabwe.

Mugabe's visit is widely viewed in African diplomatic circles here as a reconciliation with the Soviet leadership, which had supported Mugabe's rival, Joshua Nkomo, during the bush war against the white minority government that ruled Zimbabwe.

During the visit the Zimbabwean and Soviet leaders seemed to overcome any past differences.

As a result of his trip to Moscow, Mugabe said, "we are very much closer in our ideas, in the rapport that we have created, and in our assessment of international issues."

Calling the talks "fruitful," the Zimbabwean leader praised the Kremlin's attempts to help in "the process of liberation of South Africa and Namibia." Mugabe said that when Soviet officials visit Zimbabwe, the two countries will conclude the terms of cooperation in mining, agriculture, transport and roads, under an economic and technical cooperation accord signed yesterday.