The LIRR will take forever. Don't do it.
You can take the Jitney, but that too can take more than 3 hours depending on the day and the time of year.
And once you arrive, you'll find that "the Hamptons" are a sprawling series of towns, where you really need a car to get around unless you confine yourself to one place, like East Hampton or Southampton or Amagansett. Having said that, they're just beach towns with really, really fancy shops. Kind of like being on Madison Avenue with a beach a few blocks away.