Caffeine can cause hair loss and on the other hand, it can also halt hair loss. Everyone has a different body and such foods react in a different way.
It is always safe to try something that is healthy and side-effect free.
Your hair needs protein, you should increase the intake of iron, vitamin a, vitamin e, omega 3 biotin, zinc and slenium.
Foods like dairy, egg, greens (spinach), citrus fruits, fatty acids, carrot, sweet potato.
As for caffiene, 200 mg of caffeine a day appears to be safe for most healthy adults. That's roughly the amount of caffeine in two cups of brewed coffee.