President Reagan, defending his policy of "constructive engagement" toward South Africa, said yesterday he will continue to resist sanctions against Pretoria and suggested that the South African government's actions against violence in recent weeks have been justified.

Reagan stopped short of saying whether he will veto sanctions pending in Congress, but insisted that "the results we've had" with a policy of trying to influence South Africa though diplomatic contacts "justifies our continuing on that score."

In his first meeting with reporters since cancer surgery July 13, Reagan also indicated he would be willing to join the Soviet Union in a permanent moratorium on nuclear testing once the United States had finished its planned tests. But the White House later issued a statement saying Reagan was "not proposing any new initiative" on a test ban.

Speaking from his desk in the Oval Office, Reagan announced in a nationally televised statement that he would launch a "major fall offensive" on behalf of his proposal to overhaul the tax laws, and for line-item veto authority and a constitutional amendment requiring a balanced federal budget.

The president also called for separating Social Security from the federal budget sooner than scheduled in 1992, saying that it is "nothing but a bookkeeping gimmick" to keep the huge pension program as part of the budget.

Social Security is self-contained in that payroll taxes can be used only for benefits. But the program figures in the size of the federal deficit because the taxes are counted as revenues and the benefits as spending. Social Security has been part of the "unified" federal budget since the late 1960s.

Reagan looked fit, and a small scab was evident on his nose where a piece of skin was surgically removed last week, which the president disclosed yesterday had been diagnosed as a minor skin cancer. He joked with reporters and said he hopes to be horseback riding on his California ranch next week.

Reagan opened the 25-minute session with an optimistic statement heralding "a year of progress" in domestic and foreign policy, and ended with an appeal to baseball owners and players to think about their "obligation to the baseball fans" to avert a strike.

White House officials have acknowledged that Reagan has suffered major legislative setbacks in the first year of his second term, and the president yesterday appeared to be promising an effort to regain momentum in September.

On South Africa, Reagan defended the administration's approach to South Africa even as world criticism of the state of emergency declared there on July 7 is intensifying. Reagan said the system of apartheid, or racial segregation, in South Africa is "repugnant," but went on to list "gains that have been made so far by our constructive engagement."

He listed "the increase in complete biracial education, the fact that American businesses there have, over the last several years, contributed more than $100 million to black education and housing, the fact that the ban on mixed marriages no longer exists, that some, I think, 40-odd business districts have been opened to black-owned businesses, labor union participation by blacks has come into being, and there has been a great desegregation of hotels and restaurants and parks and sport activities and sports centers and so forth."

These and other improvements "have been coming about as they have continued to work toward what is the final answer," he said.

Critics of South Africa have said that, despite the relaxation of certain laws by Pretoria, blacks -- who make up 73 percent of the population -- still have no political rights or representation, reside in inferior economic conditions and are strictly limited in their freedom of speech, movement and association.

The state of emergency imposed July 20 gives the South African police and military virtually unlimited powers in 36 cities and towns to seize property without warrants and arrest people without formal charge. The security forces can also seal off the areas, impose curfews and censor all news from the specified locations.

The administration demanded July 26 that the state of emergency be lifted. Yesterday, Reagan was asked what he would do to make the point more forcefully to the South African government.

He responded by saying the United States has "had some influence so far and they have themselves guaranteed that they want to make progress in that direction."

Reagan added, "You are talking, though, now about a governmental reaction to some violence that was hurtful to all of the people. We have seen the violence between blacks there, as well as from the law enforcement, against riotous behavior. I think we have to recognize sometimes when actions are taken in an effort to curb violence."

Refusing to say whether he would veto sanctions legislation pending in Congress, Reagan said some provisions "could be helpful in the very way I have been talking." He was apparently referring to provisions calling for scholarships and export promotion.

"I know also, however, that the sanctions would not only be harmful to the black citizens there, they would be harmful to the surrounding black countries whose economies greatly depend on their trade and economic relations with South Africa." The president also took note of a statement Sunday by Gatsha Buthelezi, chief minister of the KawZulu homeland in South Africa, that economic sanctions would hinder efforts to end apartheid.

Asked if there is no change planned in U.S. policy, Reagan said he would not turn to sanctions but "there can be fluctuations in your conversations and your relationship with another government."

On the Soviets, Reagan was asked why he refused to join a Soviet proposal last week for a temporary moratorium on nuclear testing, which the Soviets have said they will unilaterally impose starting today. Reagan said the Soviets are ahead in modernizing nuclear forces, and have just finished testing for their SS18, SS24 and SS25 nuclear missiles. The United States, he added, has not finished testing comparable weapons.

Reagan repeated his invitation for the Soviets to send an inspection team to watch a U.S. nuclear test, which Moscow has rejected. He said that after the Soviet temporary test ban runs out in December, "if they want to make that a permanent moratorium or if they want to agree with us and have bilateral inspection of each other's testing, we're willing to do that."

The president then qualified his remark by saying he would not be prepared for a joint test ban until the United States tests the warhead for the Midgetman missile, now in development, "and we haven't even come to that stage yet."

White House spokesman Edward P. Djerejian said later yesterday that Reagan was "not proposing any new initiative" on nuclear testing. He said the United States "has long supported the objective of test ban negotiations in the context of achieving deep and verifiable nuclear arms reductions, substantially improved verification capabilities, expanded confidence-building measures and the maintenance of an effective deterrence."

Djerejian reiterated the administration's concern about verification. He noted that Reagan had said the focus in arms control should be reducing nuclear stockpiles, which would provide a "genuine incentive" to cut back testing.

A senior official told reporters last week that the United States needs to continue testing nuclear weapons, and Djerejian said yesterday "the basic necessity for our testing derives from the massive buildup of Soviet offensive power."

Reagan said in his statement that the United States is in "the best position in more than a generation to achieve real reductions of nuclear weapons. All we need is a serious approach by the Soviets."

On the eve of the anniversary of the dropping of the atomic bomb on Hiroshima, Reagan said that it was a decision made to stop World War II, "and I think to second-guess now those who had to make that awesome decision is ridiculous."

"I think, horrible as it was, we have to say this, too -- that it did give the world a view of the threat of nuclear weapons," he added. "And I think that should be an aid in one day now ridding ourselves of them."