BOSTON (AP) _ A Rhode Island town law allowing the arrest of people who sleep on the beach or in their cars is vague and discriminatory, a lawyer argued Tuesday in court.

''The decision to enforce lies totally with the cop on the beat,'' said Gary Berkowitz, lawyer for the American Civil Liberties Union in Rhode Island.

''Some people will be charged and some people won't. There's no consistent application of the law,'' he said.

The state ACLU challenged the law on behalf of two men arrested in Westerly in July 1988. The case was expanded to a class action covering more than 250 people arrested under the town ordinance, which has been on the books since the 1960s.

The ACLU appealed to the 1st U.S. Circuit Court of Appeals in Boston after a federal judge in Providence last year rejected a challenge to the law's constitutionality.

The law is so vague that it could result in the arrest of a man who dozes off while waiting in his car for his wife to leave a store, Berkowitz argued before the 1st Circuit.

John Levanti, an attorney representing Westerly, said officers used common sense when enforcing the law.

''When they come across people who are obviously asleep, one across the front seat and one across the back seat, clearly they've broken the law,'' he said.

Levanti said the law ensures the health and welfare of residents of Westerly, a seaside town of 20,000 that swells to 60,000 with tourists on a summer Sunday.

''What they don't want you to do is trash the place,'' he said. ''Defecation, broken bottles, discarded food - all the trappings of people who are living, but not living in accommodations.''

Berkowitz said enforcement was unfair because state residents were given summonses and released, while out-of-staters were jailed unless they pleaded no contest and paid a $20 fine. Some people were held for up to 12 hours, he said.

Levanti said out-of-state residents were treated differently because if they fled after release there was no way to bring them back to court on the misdemeanor charge.

Berkowitz said state courts in Florida and a federal court in New Orleans have struck down similar laws. Some California courts have upheld them, he said.