The land of the free and the home of the brave does not look quite so bold and free-speaking to many foreign writers at the 48th International PEN Congress, which opens in New York today. As many as a dozen of the widely regarded foreign novelists, poets and playwrights invited to the annual convention of the most famous international writers body have been stigmatized as subversives under a cynical remnant of McCarthyism that is totally at odds with our most revered traditions and international obligations.

Sections of the 1952 McCarran-Walter Act permit our government to ban from the United States a wide range of people who can be branded by bureaucratic and secret evidence as everything from anarchists and communists to professional beggars and prostitutes. Although many visitors overcome initial charges, the process is a demeaning and embarrassing ritual that suggests we are not as confident, mature and truly free a nation as we so often assert.

Under the sweeping rubric of activities "prejudicial to the public interest" or "subversive to the national security," Sections 212 (a) 27 and 28 of the Immigration and Nationality Act have been used to bar a few foreign political figures or intellectuals to the right of center. But for the most part, the law has been applied against scores of "left-wingers," ranging from actor Charlie Chaplin to Canadian naturalist Farley Mowat, from Japanese pacifists to Italian playwrights, from Nobel-prize-winning authors to Nicaraguan officials. Three thousand Canadians, including some officeholders, are on the blacklist maintained for that country. Immigration computers, with unreasoning precision, routinely bar many exiles from East European countries because they once were communists.

In short, the law has been applied capriciously and often to exclude from the United States people whose beliefs, statements and associations may be unpopular, but hardly present a threat to our national security.

There are, of course, legitimate grounds to bar foreign visitors to our shores. Foreigners with deadly and infectious diseases, drug traffickers and other criminals, suspected terrorists and those who indicate they would act to overthrow our government are genuine risks.

But in the long and painstaking reform of the nation's immigration law, Congress has sidestepped a long overdue revision of Section 212 (a) 28. It is time to prove that we are not afraid of mere ideas and speech.

During 1984 hearings in the House, State Department and Immigration officials insisted that they do not exclude foreign visitors on the basis of speech alone. Nevertheless, several officials gave weak and vague reasons for a variety of exclusions. One official could offer no more than "foreign policy considerations" or "the president's prudent conduct of our foreign relations" as arguments.

Prior attempts to revise the law, such as the 1977 McGovern Amendment, removed some admission barriers for controversial foreigners who are invited to participate in conferences or speak at leading universities. But the government has been able to use other sweeping sections of the law to exclude visitors.

Foreign visitors do not share the same rights as Americans. But once they can meet health, criminal record and national security standards, they should not be branded as subversives for what they have said or would say.

There are two fundamental reasons to delete sections that grant such broad discretion to bar individuals for little more than the views they hold. First, these exclusions are a form of censorship that intrudes on the First Amendment rights of Americans to hear different ideas and arguments. Today's telecommunications media can bring into our living rooms the images and voices of exponents of every political and artistic tendency around the globe. To deny these speakers physical entry onto our shores insults the intelligence of the American people, as well as injuring our freedoms.

Second, the act flies in the face of our obligations under the 1975 Helsinki Final Act, which called upon participating states to ease travel and, as a result, encourage a freer exchange of ideas. While Soviet violations are far more flagrant, the McCarran provisions leave us as the only Western democracy with an ideological test of purity for visitors. Imagine the reaction of Americans if they were subjected to such tests before they could visit Paris, London or Istanbul.

William Styron, the writer, once noted that never in all his travels abroad had he been forced to submit to the humiliating questions that many of his foreign colleagues faced before coming to the United States. He added: "The great and shameful irony is that in oppressive communist and fascist countries this is the sort of legislation that forces dissident writers to flee their own countries."

One controversial Latin American writer described his experience in obtaining entry to the United States: "When I got to New York, they held me for hours at the airport, looking at me through a glass window as though I was a giant panda, carefully unfolding my socks, underpants and the rest of my luggage, in search, I imagine, of my subversion."

Immigration examinations and searches are necessary for weapons, drugs, indications of disease and other problems, including involvement in political action that constitutes a legitimate threat to our national security. But the persistence of Section 212 (a) 28 investigations, waivers and exclusions amounts to a perversion of our most cherished beliefs in free speech and the open marketplace of ideas.