I bought a tomato plant about a month ago. Recently, I have seen some black and white flies around my plant. The plant has some flowers as well. is it normal? what should i buy to get rid of them?
Tomatoes are subject to attack by a large number of insect pests from the time plants first emerge in the seed bed until harvest.
It is really important to correctly identify the pest, so that appropriate treatment can be recommended. Without a photo it is difficult to correctly identify what type of insect you might be dealing with. From your descprition it could be that you are dealing with either whiteflies or a type of aphid. Have a look at this link for whitefly identification to see if they resemble the insects in your garden: https://bugguide.net/node/view/7055 or if they resemble aphids https://bugguide.net/index.php?q=search&keys=aphids&search
The most important consideration when you’re thinking of insect control is: what damage are they doing – if any?
Whiteflies are typically most damaging during their nymphal (not flying) stage; they suck plant juices from leaves. Aphids also suck plant sap and cause distortions in the plant leave, flower, and buds. It’s important to hose down the infestation with water spray, and to remove infested leaves by hand. You may have to do this several times, to destroy a few generations of adults.
The Toronto Master Gardeners, in partnership with the City of Toronto, have prepared a Garden Guide on Controlling Insects Organically
The fact that the plant is producing flowers is a good sign. Tomato flowers can be temperamental. If it gets too cool ( below 13C) or too hot ( above 32C ) the flowers of most varieties will pause from setting fruit until the temperature is back where they like it.
You might wish to review this Growing Guide for tomaotes from Cornell University.