If we look directly at the energy available and nothing else, the rough estimate we can find is that animals can turn ~10% of the energy they consume into body mass. The rest of the energy they take in is lost through inefficiencies in digestion, moving around, and the energy needed just to stay alive. This is called ecological efficiency. In reality, it differs between lifeforms and can be a few times higher or lower than 10%, but it's a good enough estimate.
Going online, we find that 100 grams of banana has around 89 calories. Insects are a bit more calorie dense, and we can actually find good values for fruit flies! They are roughly 5.12 calories per gram of mass. Putting it all together, this gives us a maximum of roughly 8.9 calories stores as insect flesh, at 5.12 calories per gram, is roughly 1.7 grams. If a single D. Melanogaster weighs 1 milligram, then that gives us a maximum of 1,700 fruit flies! But that is a maximum that doesn't take into account nutrition.
A banana is mostly sugar and fiber, animals are primarily protein and fat. If we look at a banana's nutrition fact sheet and compare it to the fruit flies, we can see a huge difference between the two (I have posted links below). They have an equal amount of water, so they should be fine without anything to drink. The amount of proteins and fats in 100 grams of banana is only around 6% of what you'd find in the same amount of fruit fly mass though. That's still enough for 6 grams of fruit fly mass though, or around 6000 flies. What really brings us down is sodium. Animals need sodium for neurons and other processes, but it's a lot less necessary for plants. Bananas have almost none of it. A banana only has 0.2% of the sodium in it that a fruit fly does. This brings the maximum number of flies down to 238.
That still feels like a lot of flies to me, so there might be some other minerals and nutrients that I haven't considered here. I'm not sure, but I'm willing to guess that 238 flies is somewhere within an order of magnitude of the correct answer.
https://fdc.nal.usda.gov/fdc-app.html#/food-details/173944/nutrients
https://www.researchgate.net/figure/Nutritional-value-of-fruit-flies-of-species-Drosophila-melanogaster-and-Drosophila-hydei_tbl1_340395391