Eighteen-hundred miles due north, the Democratic contests in New England are coming down to the wire, but for the moment, Sen. Edward M. Kennedy is sitting in front of a thatched-roof bohio sipping papaya juice under the muggy shade of palm fronds and plantain leaves, arguing whether Puerto Ricans should be allowed to vote twice.

Surrounded by an extra cautious security detail that is armed with three submachine guns, Kennedy is touring the jungle-like ground surrounding the palatial home of his most prominent backer here, former governor Luis Munoz Marin and explaining why he has taken his presidential campaign to the tropics.

The main reason is money. At a $250-per-person party at his mother's home in West Palm Beach Thursday night, and at a $1,000-per-ticket dinner in San Juan tonight, Kennedy is raising more than $100,000 to help him through the primaries and caucuses in New England over the next four weeks.

But Kennedy also came to Puerto Rico in search of votes; the island will send 41 delegates to the Democratic National Convention, more than 25 states and more than Maine and New Hampshire combined. That's where the argument about voting twice comes in.

Both parties are holding presidential primaries here this year, and under some interpretations of local election law, it is all right to vote in both primaries.

That interpretation has been championed by the current governor, Carlos Romero Barcelo. Although Romero has endorsed President Carter for re-election, many members of his New Progressive Party are Republicans who will vote in the GOP primary here Feb. 17.

Romero's machine is urging them to vote again -- for Carter -- in the Democratic balloting March 16. The message has been crystalized in a unique campaign slogan: "Primero en elepante y destues en burro." ("first in the elephant's primary and then in the donkey's.")

Munoz Marin and his mostly Democratic Popular Democratic Party, which supports Kennedy, have challenged the legality of double voting. The Kennedy people's slogan is "primarias sin fraude."

In his mainland campaigning, Kennedy often quips about voting twice -- "That's the way we do it Massachusetts," he says -- but now it is no laughing matter. "Double voting makes a mockery of the democratic process," he said during his visit to Munos Marin's lush estate.

To confuse matters further, Kennedy has become aligned with the party that favors continuing Puerto Rico's commonwealth status, and Carter has the backing of the statehood party -- although both men are neutral on the question. San Juan politicians say the presidential primary will probably turn mostly on local concerns.

Kennedy's day here was a busy and colorful tour that took him from an underwear factory just off Avenida J. F. Kennedy -- where hundreds of women pushing gray, white, peach, pink and canary T-shirts through sewing machines squealed and danced to greet him -- to the "Kennedy Para Presidente" headquarters, a pagoda-like building on Avenida F. D. Roosevelt that used to house a Chinese restaurant.

The day was no fun, however, for the Secret Service. Extremely worried about the possibility of terrorist activity, the agents tripled the usual protective detail, brought out the Uzi submachine guns that are normally kept in a case in their car, and kept the candidate literally in their grasp from the moment he set foot on the island.

The agents' anxiety was contagious, and the entire Kennedy entourage had collective heart failure this afternoon when five shots rang out on the front porch of Kennedy's hotel in San Juan.

The shooting, it turned out, had nothing to do with Kennedy who was in his 20th floor suite. A teen-age boy who had been arrested in the lobby for robbery broke and ran, and a pursuing policeman fired the shots to warn him to stop. The only casualty was a lamp outside the hotel's door.

This occurred a few hours after Kennedy was asked in a TV interview whether he worries about his security.

"If one ignored the potential dangers, one would not be rational," Kennedy said. "If one were obsessed by them, he would not be able to continue in public life."