There are two reasons your dog could seem to be racist, possibly three.

1. The dog was not socialised properly as a puppy. I think this plays a major part in the problem.
The way you describe the behaviour it sounds, at least partly, like a fear reaction.

2. Once the behaviour had been noted by you (not something you can miss!) it is natural for you to react before the dog has. You automatically tighten your grip on the lead and tense your muscles - you are probably not even aware of it. Dogs' are reading body language constantly and it may be that, along with a protective and fear reaction that is causing this to continue.

3. The last owner may of abused the dog. This in itself would not make the dog wary of all black people. But may be a factor in the first time you saw the reaction from the dog.

As your dog is now three and has missed the critical developmental stages of socialisation, I'm afraid you may never see a complete recovery from the behaviour.
There are things you can do, however. Time is crucial and you must allow plenty of time before taking the next step - I'm sure you know that pushing a fearful dog to the limit will result in a bite nine times out of ten.
If you can convince the dog that you will take charge and keep it safe and that it does not have to worry about you in such situations it will help enormously. (I am always shouting my mouth off about this and I'm sure everyone is sick to death of it so if you want some ideas please email me.)
You see what is coming before the dog does as your line of sight is higher than it's. This gives you a few seconds to prepare how to tackle the oncoming situation. Getting the dog's attention onto you is vital - whatever works for you, be it treats for sits, heels etc. or a toy pulled from your pocket at the crucial moment. Buy some extra time by producing the treat/toy and changing direction - this gives you a little time to focus the dog and some thinking and planning time. If there is room to do a large, squared off, circle around the person approaching, still using the treats or toy as distraction, that is great. When you can do this without problems you can gradually lessen the detour - very slowly.

For situations where you can't get around it is probably best to turn around and wlak back the way you have come, using the treats/toys as attention grabbers and finding somewhere to sit the dog safely. Try to keep attention on you until the person has passed. As you have had a little time get the dog to sit and stand in front of it so you can use your leg as a barrier if need be.

It is important to stay as calm as you possibly can. (You may consider writing a few little notes saying that you are sorry if the passer by was frightened or startled and that the dog has an abusive history that you are trying to work out with it. You may even get some offers of help...use them as set ups for the dog.)

Slow and careful socialisation is also needed. Sitting quietly in the park, maybe even feeding some of the dog's meal while there and very gradually getting closer to the action.

This must be very difficult for you and pretty distressing too. It will take time and a lot of care - one slip and you are back at step one. I don't envy you at all!

I used to train guide dogs for the blind and it was usual for us to test each others dogs' before they were passed onto instructors and final owners. To do this I put on a blindfold and walked the other trainer's dog down a city route that I knew. On this particular day all was going well and the dog was doing a fantastic job in a very busy area. Suddenly my blood ran cold as the dog froze, backed up slightly and began snarling and barking very rapidly. There were a lot of people around us and I had been in blindfold for about fifteen minutes so was still almost blind when I took it off. Very scary indeed! The dog's trainer was following us to make sure we were safe and ran up to take control.

The cause? The dog had never come across a black person before in it's life and had met a group of four adults with two children around ten years of age blocking the path. The dog simply didn't know what to do and did not have experience to fall back on. It didn't trust me to take charge (I'm a wimp when blindfolded on a busy street!) and reverted to taking care of itself!
The two families were fantastic, saw the funny side and helped a great deal in making a first class guide dog!