Can I prevent rabies if I get bit, but then immediately take a rabies vaccination?

Yes, several shots. If a person was bit by a rabid animal, and he got: his wound properly washed out, his rabies IgG properly given, and his rabies vaccines properly given, all within the recommended time periods, then he can presume that he will not get rabies. Nothing is 100% certain in life, but proper rabies treatment works.
Yes. Yes, rabies vaccine, when administered after exposure on an appropriate schedule, is nearly 100% effective. Remember that you should also wash the wound effectively and seek medical agrs tin asap.