Barley two weeks after taking office, Prime Minister Abel Muzorewa traveled to South Africa this past weekend for talks, a step unlikely to win him any friends among the black-ruled state to his north.

Coming so soon after he assumed power June 1, the trip underscored what are bound to be close ties between Muzorewa and the only country that openly trades with and arms his government.

This unofficial relationship is likely to become formal if black Africa continues its unanimous refusal to recognize Muzorewa's black-led government.

The black state have shunned the new biracial government because they say it does not provide true black majority rule and because it gives no role to the Soviet-backed guerrillas, whose war against the previous government helped pressure the white minority to relinquish its dominant role here.

At this stage, closer ties between South Africa and Zimbabwe-Rhodesia reduce the chances of Western efforts to get all the parties involved in the conflict to negotiate a settlement. With solid South Africa backing, Muzorewa is likely to be less open to the idea of talks with his guerrilla foes.

In announcing the trip today, Muzorewa's office gave no details of his four-day stay in Pretoria, except to say he discussed "matters of mutual concern" with South African Prime Minister Pieter W. Botha.

South African press reports speculated that the two men discussed strengthening their defense ties. South Africa already provides the bulk of Zimbabwe-Rhodesia's military needs. It even facilitates one-year stints in the beleaguered country's army by South African soliders on leaves of absence, according to well-informed sources.

Botha, who is also defense minister, has shown a greater willingness to back the Salisbury authorites militarily than his predecessor, John Vorster, and most obdervers expect increased South African involvement.

A defense alliance aimed at preventing a guerrilla takeover in Zimbabwe-Rhodesia suits the goals of both governments. For Muzorewa, it means added security against his guerrilla opponents. For South Africa, it means taking a stand against Soviet-supported insurgents in Zimbabwe-Rhodesia rather than on their won vulnerable northern borders at a later date.

Last Friday, former prime minister Ian Smith, now a minister without portfolio, told a group of South Africans who live in Salisbury that the Zambezi River, Zimbabwe-Rhodesia's northern boundary," is a far better line to hold than the Limpop River, "South Africa's northern boder.

"This is obvious and logical," Smith said.

Muzorewa has laready stated he has no objections to friendly ties with South Africa and even to participating in a defense pact.

Botha has sought to create a "constellation" of southern African states with friendly economic and military ties to Pretoria, which can only succeed if Zimbabwe-Rhodesai cooperates. It is in a key geographical position. The two prime ministers are also thought to have discussed this endeavor.

The South Africans had close ties with Muzorewa even before he became prime minister, advising him during last year's negotiations with Smith that led to the new government here.

When Muzorewa took office, his first official visitor was Piet Van Vuuren, the South African resident diplomatic representative.

In another development today, Muzorewa's office announced the resignation of Jack Gaylard as secretary to the Cabinet.

Some observers see Gaylard's removal from a post he has held since 1970 as a gesture by Muzorewa to show Britain that a new order has taken hold in Salisbury despite the severe restrictions on his government by the continued political role whites are guaranteed under the new constitution. Britian, which ruled Rhodesia until it broke away in 1965, is considering renewed ties.

Gaylard is a long-time political associate of Smith who was disliked in the British government for what one observer called his "obstructionist" attitude in London's many attempts to get a political settlement to the Rhodesian problem.

Gaylard's departure, however, also demonstrated Muzorewa's limits in making apointments - a condition imposed by the present constitution.

Muzorewa's nominee for the job, a Zimbabwe-Rhodesian of Indian extraction with ties to Muzorewa's party, was rejected by the white-controlled civil service commission because he did not meet the requirements for the job, according to informed sources.

Gaylard was replaced by another white, Solicitor General George Smith, who played a key role in writing the new constitution. CAPTION: Map, no caption, The Washington Post