Consider contacting your local newspapers and let them know whats going on...
Don't let it go by without telling everyone you can about it. Otherwise, it will keep happening.
Before you do this, and I suggest you do if this persists, you need to find out what the ordinance is that you were called on. Go to Town Hall and have them cite the ordinance for you, and get a copy. I suspect it has something to do with the beaches closing at a certain hour. Cops are people, and the majority of them are just trying to do their jobs and enforce the law. But in situations like this, there are some grey areas, and if it's not a commonly enforced ordinance, the cops might be unfamiliar with the limits of the law and you personal freedoms. In fact, those cops might not even be local... lots of towns hire cops from other towns part time during the summer, further adding to the confusion.
But if you were right and they were wrong, keep a copy of that ordinance in your car, and if stopped again, do not challenge the cop, but simply say that, "it was explained to me by the Court Clerk (or whoever... it helps to have a name) that it's within my right to surf here at this time," and "I looked into it because I wanted to be sure I wasn't breaking the law... that's the last thing I want to do." Sometimes an approach like that can go a long way.
News reporters have certain freedoms we don't have, and that includes access to police records and "the books" in any town they cover. As a former newspaper reporter and editor, I know that the cops and the press have to maintain a relationship, and they can get a lot further than you can, if it comes to that. A little digging on their part can be pretty effective in clearing up the issue.