Jeered by whites and cheered by blacks, Sen. Edward M. Kennedy (D-Mass.) said yesterday that he will return home to seek independence for Namibia and to oppose President Reagan's policy toward South Africa.

Kennedy told several hundred people in the black township of Katutura outside Windhoek that the next time he visited the territory he wanted it to be independent according to a long-standing United Nations plan.

"I will go back to the Senate of the United States to say I have met brave men and women in Namibia, whose only desire is to be free," he said outside a Roman Catholic church where he met with church and nationalist leaders for two hours.

The Massachusetts Democrat said he would work to end the Reagan administration's policy of "constructive engagement" with South Africa, which he said "has been an ineffective and bad policy," The Associated Press reported.

Hundreds of nationalists greeted him in Katutura. Many in the crowd were backers of the South-West Africa People's Organization, which operates as a legal political party in South-West Africa although South African forces are fighting a bush war against the organization's guerrillas based in neighboring Angola.

Dozens of whites picketed Kennedy when he arrived at Windhoek's airport. They carried signs reading, "We can do without American liberal hypocrisy," and, "Mr. Kennedy, you have never done anything for Namibia so go home."

South Africa, which invaded German-ruled South-West Africa on behalf of the Allies in World War I and later controlled the territory under a League of Nations mandate, governs Namibia in defiance of United Nations calls for independence.