More than 300 foreign peace activists, most of them from Japan, have been denied visas to attend a United Nations disarmament conference that opened yesterday in New York because they are affiliated with organizations that have communist ties.

The State Department initially denied the visas last week under the 1952 McCarran-Walter Act, which bans entrance to this country to any alien affiliated with a communist or anarchist organization.

When news of the visa denials broke, the department said the action was mandatory under the McCarran Act, and that the names of 357 applicants had been sent to the Justice Department to see if any waivers should be granted.

Duke Austin, a spokesman for the Justice Department's Immigration and Naturalization Service, said yesterday that its examiners decided to waive the denials in 42 cases where the applicant had received a personal invitation from the United Nations to attend the conference.

As for the remaining 315, Austin said there were "no special circumstances in any of the cases that would warrant a waiver." He added that Attorney General William French Smith, while he did not "personally review every case . . . was aware of the decision."

The denials drew a sharp protest from peace movement leaders, who will try to overturn them today in U.S. District Court in New York.

"This is an act of political weaklings and it will not succeed," said Sidney Peck, director of the International Liaison Office in New York, a private group that is helping to coordinate the U.N. conference and a huge anti-nuclear rally planned for Saturday in Central Park.

"They must indeed be frightened of the growing international movement for disarmament," Peck added.

Some 286 of the 315 unsuccessful visa applicants are members of Gensuikyo, a Japanese organization with ties to the World Peace Council, "an organization with strong affiliations with the Communist Party of the Soviet Union," according to the State Department.

A spokeman for the State Department said that once Justice decided not to grant waivers, the matter was closed.

But peace groups and the American Civil Liberties Union, which is representing them in court, said the government had chosen to invoke the McCarran-Walter Act in an arbitrary and haphazard way.

They are seeking a temporary restraining order in U.S. District Court.

ACLU lawyer Steven Shapiro said the State Department initially identified more than 500 foreigners with ties to "proscribed" organizations, but, for reasons that are not clear, chose to grant visa applications to more than 100 of them, including some members of Gensuikyo.

He also said that several hundred members of the Japanese organization, whose name stands for "Japanese Council Against A and H Bombs," were allowed to attend a similar United Nations disarmament conference in 1978.

U.S. District Court Judge Pierre Leval, during court hearings yesterday, asked the government's attorney to present letters in which the administration formally sets forth its reasons for denying the visas. He also ordered the government to produce records of how often the McCarran-Walter Act has been invoked.

The United Nations has invited 1,400 individuals from 375 organizations around the world to be observers at the session. Some 500,000 peace activists are expected at the anti-nuclear rally on Saturday.