Sen. Edward M. Kennedy (D-Mass.), just back from a stormy tour of South Africa, pronounced President Reagan's policies of "constructive engagement" a failure yesterday and pledged his support in Congress for legislation to impose economic sanctions against that country for its system of racial segregation.

"We can't resolve all the problems around the world, but we should make sure the United States government is not helping and financing apartheid," Kennedy said during a Capitol Hill news conference.

Flanked by leaders of the Free South Africa Movement, who have organized nationwide protests against apartheid, Kennedy praised the group's continuing demonstrations at the South African Embassy and elsewhere, saying they "have brought this issue home."

The arrests of apartheid protesters continued yesterday at the embassy, where five persons, including Dr. Frederick Green, vice president of D.C. Children's Hospital, were charged with demonstrating within 500 feet of the embassy. Yesterday's protest was billed as "Physicians' Day" and drew about 150 demonstrators, according to police.

Kennedy's eight-day trip to South Africa stirred a range of emotions among white and black South Africans. Whereas his brother, Robert Kennedy, was a uniformly popular visitor in 1966, Edward Kennedy was booed by militant black demonstrators, who resent U.S. support for and trade with the Pretoria government, and he had to cancel one rally appearance in the black township of Soweto for fear of violence. Whites reacted angrily to his criticisms of apartheid.

"I wanted to indicate to South Africans, black and white alike, that the policy of constructive engagement is a failure and that there are millions of Americans opposed to it," Kennedy said.

Constructive engagement is a term coined by the Reagan administration to describe the U.S. practice of maintaining good relations with South Africa while gradually seeking changes in its racial policies.

Before his news conference, Kennedy met with D.C. Del. Walter Fauntroy and Randall Robinson, cochairmen of the Free South Africa Movement, and members of its steering committee. He briefed them on his visit and discussed upcoming legislation that would cut U.S. trade and other ties with South Africa.

Kennedy said his efforts on behalf of such legislation would be "more effective" than getting arrested as part of the demonstrations at the embassy, now in the ninth week.

But Kennedy also noted that numerous cities and universities are taking their own steps to divest themselves any business interests in South Africa and warned that the Pretoria government "makes a serious mistake if it thinks the only action on apartheid will be in Congress."

He dismissed a suggestion that South African blacks might be hurt the most by such divestiture moves, saying such an argument "is almost inevitably made by white businessmen" there.

During his trip, Kennedy visited with Winnie Mandela, wife of Nelson Mandela, the leader of the underground African National Congress, who has been in prison for 22 years.

U.S. investment in South Africa, he said she told him, "is a shoulder to the wheel moving apartheid forward."