An allergy can only be dealt with by you and your doctor. If your toddler's stools are runny or not quite right, you could be dealing with an allergy. Check out the Bristol Stool Chart to measure it all up.
Although both of these are in the same category, fear is typically not the culprit. True fear grips you in the throat, like if you saw a snake or a mouse! Anxiety is more the cause, which is easier to deal with.
Anxiety can be explained away through education, calm words, and trust. If you take time to intentionally build trust with your child, you can ask him to do something scary, and tell him to trust you. It will be fine. Be intentional. Talk about trust and what it is. What it means between two people. Talk about how you'll always be there for him, how you won't lie to him, how you're always on his side. Build trust, then potty train off of that trust.
This is often such a doozy to parents. Toddlers can be entitled. Especially those three year olds that don't have household jobs, that get what they want, that can argue to get their way... You won't be potty training very well from this place. You need to be the head of the household, and a leader of your children. They should respect you and know that they are valued and important to the family. Realigning who is truly in control and having children work for their desires can bring a child back to his rightful place. And potty training becomes much easier.