The plant is likely getting too much nitrogen, which triggers it to grow foliage, and not enough phosphorus, which favors flowering and fruiting. Choose a fertilizer that has a balanced ratio of the three major elements, such as 10-10-10, or where the middle number (phosphorus) is larger than the first number (nitrogen) such as 2-3-1. Tomatoes are heavy feeders and usually do need fertilizer unless your soil is very rich. But follow manufacturer's directions to avoid overdoing it.