Keep in mind that owners need a place for their dogs to run free. Many take advatage of open space trails to fill this need believing their dog won't be a problem for any of the few who they encounter.
That being said:
If the area you are riding in is managed (state/national park, trustees of reservations, etc) contact the ranger or managing group and register a complaint. They're more likely to react to a problem if it is brought to their attention.
As for the owner, politely asking them to leash their dog is about as good as it gets.
As for the dog, just keep on riding if you can. Keep your cadence up so that if he does go for you, there's a good chance he gets a heel in the face rather than a mouth full of calf. If you feel threatened, dismount and keep your bike between you and the dog until the owner can get him under control.
If it's frequent, carry pepper spray. Use it if you feel threatened. If my dog got sprayed by a biker, I'd be more likely to leash him when I hear one coming than wait until there's a problem.