Not only in seedlings, but even in pots with indoor plants, small midges sometimes appear, from which you definitely shouldn’t expect any good.
The reason for their appearance is wet soil. In fact, their appearance can be considered an indicator of soil moisture.
In this case, you can use chemicals, but no one wants to immediately season the seedlings with something unknown at an early stage.
To prevent flies from appearing, water should be poured into the tray when watering or when the top layer has dried out thoroughly.
Another point is the color of the flies. If they are black, then it is not so bad. But when whiteflies appear, it is better not to experiment.
Gardeners recommend using the drug "Aktara". The drug is used according to the instructions once every two weeks. But there are no consequences. Its components tend to accumulate in the fruits of plants.
For this case, you can spread orange or tangerine peels on top of the soil.
Another option is to install sticky traps and change them periodically. But again, if we are talking about whitefly, then both options are not worth considering.