Yes, dogs with demodectic mange can go to the beach with precautions. Use a fragrance-free, non-toxic sunscreen formulated for dogs, and reapply throughout the day, especially after swimming.
Consider a UPF protective shirt or hat, rinse salt water off after leaving the beach, and keep your dog away from other animals that may carry infectious diseases. Contact your veterinarian if the skin becomes irritated or infected.