A federal judge in New York yesterday refused to order the government to grant visas to 315 allegedly communist-linked foreign antinuclear activists who had wanted to attend a disarmament conference at the United Nations and a rally this weekend in Central Park.

U.S. District Court Judge Pierre Leval, relying on a 1972 Supreme Court decision, said the court has "no power to inquire into the wisdom or basis of the government reason" for denying the visas.

The visa denials represent one of the most-sweeping applications of the 1952 McCarran-Walter Act, which bars entry of aliens affiliated with communist or anarchist organizations.

Over the years, such denials have routinely been waived by the government except when it was believed the applicant posed a security threat.

This year, however, a State Department spokesman said the administration was confronted with a "new set of circumstances" in trying to determine whether to approve the 315 visa applicants, most of them members of the Japanese group Gensuikyo that allegedly has Soviet ties.

"Foreign-based Soviet front groups are seeking to bring their leaders and members to the United States en masse to organize and exploit public activities planned around this U.N. session," the State Department said. "The administration has concluded that it is not in the public interest" to admit routinely such foreigners for such a purpose.

When the visas were denied, the Non-Governmental Organization Committee, which is helping to put together the disarmament activities in New York, sought relief in court on First Amendment grounds.

Leval, in his 10-page opinion, said the controlling case was Kleindienst v. Mandel, a 1972 Supreme Court decision involving denial of a visa to Ernest Mandel, a Marxist scholar from Belgium.

Mandel had been invited to attend a 1969 Stanford University Conference on the Third World but, based on his alleged failure to observe limits placed on his activities during two previous visits here, U.S. Attorney General Richard G. Kleindienst denied his visa application.

The Supreme Court ruled in a case brought by American scholars that "since the attorney general had exercised his power negatively on the basis of facially legitimate and bona fide reasons, the court would not look beyond the exercise of that discretion." Mandel had long since given his speech by telephone.

The United Nations has invited 1,400 individuals from 375 organizations around the world to attend its second five-week disarmament conference, and thousands of other observers have come on their own. Aliens who had invitations to attend the conference were granted visas.

In 1978, when the first U.N. disarmament conference was held, the administration chose not hold up the visas of members of Gensuikyo and more than 100 came.

Under the McCarran-Walter Act, foreigners who are members of a "proscribed organization" are so identified by the State Department when they apply for visas. The department withholds the visa, but forwards the case to the Justice Department to see if a waiver is warranted.