Rep. Barney Frank (D-Mass.) said yesterday that he will introduce legislation to repeal longstanding provisions of U.S. immigration law allowing foreigners to be denied entry solely because of their political beliefs and affiliations.

Frank, a member of the House immigration subcommittee that investigated the issue last year, said, "We have to stop acting as if admission to the United States is an enormous favor we're doing for foreigners." He said travel policies should be regarded "as a matter of freedom of association for our citizens."

Frank's statement was sparked by U.S. refusal to allow a prominent Canadian wildlife writer to enter the United States at Toronto International Airport Tuesday and by continuing delays in allowing entry of a Nicaraguan cabinet minister.

Nicaragua's minister of culture, Ernesto Cardenal, was forced to delay a 10-day U.S. speaking tour and remain in Managua while State Department officials considered his week-old visa application.

The Canadian writer, Farley Mowat, author of the best-selling "Never Cry Wolf," said yesterday he will do everything he can "to bring pressure to change the system" that kept him from flying to Los Angeles to promote his newest book, "Sea of Slaughter."

He said Canadian Prime Minister Brian Mulroney and External Affairs Minister Joe Clark called him Wednesday to express their regrets and offer assistance in seeking "an accommodation" from Washington. "The prime minister told me, 'Farley, this is the stupidest thing I ever heard of,' " Mowat said in a telephone interview yesterday.

Canadian Embassy officials here were more circumspect, but they confirmed that formal representations have been made on Mowat's behalf and they are awaiting response from the State Department.

State Department officials said Mowat was prevented from boarding his Air Canada flight under Section 28 of the 1952 McCarran Act barring entry of communists, anarchists and like-minded aliens. The action was taken by U.S. immigration officials who said Mowat had been listed for years in the agency's "Lookout Book," a compilation of thousands of individuals deemed inadmissible for a variety of reasons. Mowat denied that he was "a commie dupe" or member of any subversive organization. He said he had been a member of the Fair Play for Cuba Committee about 25 years ago.

Justice Department sources said Mowat once was quoted as stating that he fired a .22-cal. rifle at U.S. Strategic Air Command planes that he believed were carrying hydrogen bombs. But Mowat said he never had fired any shots and was only "spoofing" as a protest. "This goes back to a time when another writer and myself discovered there was a cache of atomic bombs at a SAC base in Stephenville, Newfoundland," he said. "We announced formation of the Newfoundland Revolutionary Society and said we were going to steal one A-bomb . . . . I said if the American Air Force interfered, we would stand them off with our trusty Swiling gun. That's a 19th-century muzzleloader. It has a range of about 40 yards."

State Department spokesman James P. Callahan said Cardenal's visa request still is "pending" because of the minister's membership in the World Peace Council, which "is considered an affiliate of the Communist Party."

Cardenal, who was to begin a series of poetry readings and talks Wednesday night, still could enter the country under a waiver, which is routinely granted to almost all those held up under Section 28, but Callahan said this could take up to another week.

Mowat, a Canadian who needs no visa, may be stuck in a more complex tangle. Waivers routinely are granted to those initially refused entry under Section 28, but Immigration and Naturalization Service District Director Ben Ferrell of Buffalo said yesterday that "we haven't refused Mowat admission" yet and would not do so unless he first meets with INS officials, something Mowat refuses to do. Ferrell, however, said Mowat could get a waiver only "if we find him to be inadmissible . . . . In our judgment we haven't completed the inspection so we haven't refused him admission."