That seems to be quite a recurring topic, so I made some research and a graph.
In game your population spreads automatically between farming and everything else.
That's because no one in their right mind wants to starve, so food's first, scienceing and industrying second.
Your main goal is to make percent of farmers as low as possible, so you'll have enough population for interesting stuff.
How is it calculated?
TL;DR* - it depends on your workforce, on your farming building, on tech related to farming** and on your race stats.
It does not depend on your population or difficulty level.
While you can multiply techs bonuses, bonuses from buildings required some calculating***.
I didn't dig top farming in latest version, so I didn't include it.
Anyway, to graph (without any bonuses from techs):

Yep, if you have workforce lower than certain level your colony will starve forever or, if it's population is 50k, simply won't develop.
As default workforce percent for most races is 31-33%%, it makes sense to upgrade to hydroponic farms ASAP, at least on homeworld.
When creating a race, never ever set farming to poor, as you'll starve from start.
At least, not without fanatical, good morale, terraforming, robotics or something else mixed in sufficient proportion.
_______________
*) Each turn your population eats population_in_millions/20 food.
Each turn your population produces population_in_millions*workforce_percent*farmers_percent*building_multiplier*farming_tech_multiplier food.
They are roughly equal, so:
farmers_percent=1/(20*workforce_percent*building_multiplier*farming_tech_multiplier)
**) Techs that give bonus to farming are: robotics (x1.5 at 10 lvl), intelligent drones (x1.37), gravity generator (x1.32), terraforming (x1.5) and replicators (x1.47).
Total multiplier therefore ranges from 1 to 5.98.
***) 0 level is no facilities - 0.08 multiplier
1 level is farming facilities - 0.17 multiplier
2 level is hydroponic farms - 0.25 multiplier
3 level is agriculture center - 0.34 multiplier