I'm really good at handling dogs, & I can tell you the first step is, convince yourself that you are too. Seriously, if you act confident & decisive, the dog will see that you're in charge & go w/ it, so first of all, gin up some confidence & get psyched: if you're confident enough, any way you handle it will work
easiest & most likely will work, same strategy as walking thru a crowded subway & not having everybody get in your way: purposeful stare at where you're going; brisk, fluid movement towards destination. people & dogs, subconsciously get out of your way. will work on a bike too
if the dog is barking & running up to you, you might need to acknowledge it, so you can then give it instructions. keep it terse. stern but not unfriendly unless the dog gets too close. give verbal commands that are simple & back them up w/ body language. even though dogs presumably don't understand our words, they'll figure it out if you're clear & emphatic. ie. loudly, 'hey dog. stay there. that's fine.' & ride off
depending on your personal comfort level & how often you plan to pass by the dog, you may want to slow down & establish that you're the alpha & whatnot, or you may want to speed up - maybe just shout HEY! & point at the dogs feet wherever you want it to stop, & speed past
also keep in mind how dogs play at a dog park: they run & chase each other back & forth. so if you're running away, acting like you're trying to avoid them, they'll chase you on account of that. but if you're going towards them, or even towards some other tangent w/out paying them any attention, it won't trigger that typical chase behaviour. same principle will help you if you're ever trying to catch a dog, but it runs away when you get close. when you make eye contact, look startled & run off. the dog will follow & you can lead it into a cul de sac