Well, unless Stellaris chooses to include worker's unions I don't think you'll have to worry about "what's cheaper, slave labor or machine labor?" The answer is slave labor. Machines are expensive. However, what's more reliable? Machine labor.
A broken machine has infinite unreliability. A poorly made machine has poor reliability. Humans tend to be closer to a Gaussian distribution individually, and a power distribution collectively, in their ability to produce things. Machines are more extreme, either being impossibly good, or utterly useless, depending on the job.
That said, were the Silicon Valley-esque idea of machines being absolutely superior to men true, then Qing China would have been crisscrossed with railroads by 1800. Which, naturally, did not happen, because railroads are expensive. Even though the Ming and Qing Dynasties were growing substantially, they eventually stalled out, and Qing became a shell of its former self when it hit the limit of labor growth. Its attempts to restrict growth had the opposite effect and it ended up overshooting in population as it restrained farm ownership (people had more kids to work more farmland to produce more rice, instead of investing in machines as was the intent), causing (eventually, and only in part) a massive famine in the latter 19th century that killed millions of people. Without mechanized agriculture and ability to move food (and soldiers) quickly, it sorta fell apart.
Unfortunately, like the labor theory of value holding water (wherein companies that fired their top executives would end up making money), machines are not cheaper. They're extremely expensive, to produce, to install, to maintain, and to design, costing orders of magnitude more than an equivalent labor-based factory run by foremen and skilled artisans, but these costs are better eaten by economies that lack the labor for the cheaper manual factory in the first place. When your population is stagnant, or shrinking, it's cheaper to try to turn the remaining people into PhDs than to try to uncover the unknowable demographic mystery of why economies trend towards demographic collapse. It's why the factory of the world was the PRC in the 1990s, and is now shifting, however slowly, to Africa (Nigeria, Congo, and Kenya, mostly), India (maybe), and Southeast Asia as the PRC becomes more and more a capital-based, labor restrained economy; while the latter are still young, demographically growing economies that can produce lots of goods for the rising import economies.
Neither machines nor labor are inherently superior. Their relative superiority comes from what the environment they exist within selects for.
In practice this tends to mean as a economy grows, if you want to buy a linear time interpretation, it eventually needs to shift from a slave economy (cf. Ancient Rome, feudal Europe, China's entire history, etc.) to a free economy that eschews labor for capital investment, because as people become richer and wealthier (or, perhaps, not even that) they have fewer babies. This makes it really hard to rely on a system that requires large amounts of freely available farmhands to do work, but makes it relatively easy to make a robot that can do something that all the farmhands in the land put together couldn't do.
In game it might be that slavery is biased towards colonization while free economies are biased towards inward growth. So slave economies end up being war mongers in the mid-game who invade their neighbors interstellar hydrogen while free economies end up being on the defensive who invest bigly in growing their planets. There are shreds of this in Stellaris, but it's not actually implemented as a true system, it's mostly just emergent. With sufficient whacking away at mineral deficits you can eventually form a titanic slave autarky, but that requires serious effort and major subsidization until you hit the economic singularity that nets you 1k mineral/food/energy production across the board.
The only weakness of slave economies ATM is that they require a fair amount of foresight ingame.
Exactly, and we are having 23rd century here.
No, Stellaris pretty much models what a video game company in Sweden views a 21st century economy as, with certain allowances for science fiction tropes like space slavery and whatnot. The map is not the territory and Stellaris is not an actual representation of the "23rd century".
Again only till the machines are more expensive. When you can get 10 slaves produce as mush as 1 machine and a machine costs 10 times more than a slave - it's fine. But the cost/production ratio of a slave is constant while machines production is growing and their cost is reducing.
What is the cost of a machine that hasn't been invented yet?
If what you were saying is true then you would expect Qing China to have been a miracle paradise appearing all the world as the United States did in the same timeframe. It wasn't. It fell apart, economically and politically, because it was incapable of shifting away from a labor economy to a capital economy. Because its policies backfired, its population growth kept going, and most importantly, it got stuck in an "equilibrium trap".
It was always cheaper in China to hire a new farmhand than to invent a railroad or something, because the distances involved in moving iron ore from Manchuria to the Yangtze were extremely big, there were plenty of navigable waterways in the Yangtze to move food and lumber instead, and there was always going to be more people to do work.
Machines are not, and never have been, inherently "cheaper" than labor.
Biological species are not optimized for non-stop mining and machines are. So from a moment it's economically unefficient to use slave pickaxing the minerals and the society have to use some aspects of automatization like give them a jackhammer (I know it's not how mining works, it's just an example). And the cycle continues. Once again we reach the point where it's cheaper to use machines, we get a new level of automatization and now slaves are pulling levers and pressing buttons
Except automation actually seems to have hit a wall, much like kleptocracy, feudalism, and slavery did before it, so that's not really the case. Automation was "the future" about 30 years ago, not so much today with increasing failures like Tesla Motors soaking up government subsidies just to try to stay afloat (let alone solvent) due to their giving short shrift to the power of labor and embracing the machine instead.
Anyway, you do not need "all the ore". You only need "as much ore as you need". If you can achieve this with manual labor or shallow mining, you will not seek to achieve more, because there is no need for the extra effort.
This is the historical norm for mankind. Shallow mines running out of tin meant that people shifted away from bronze in the 1st century AD, to iron, in Western Europe. Similar economic choices were made in Syria, India, and China at other points in time. Machines are only interesting in the past because they were the path of least resistance.
What you're describing is people choosing the path of least resistance, which is not always "more machines", otherwise the Romans would've invented steam powered, bronze backhoes and fantasy dwarf mines to get at tin deep under the earth. No, instead they went bankrupt. Then the Goths and Visigoths and Franks just found some iron ore and dug that up with their hands and picks instead.
Partially this can be explained by increasing education over time (the Solow Curve) and partially it can be explained by increased efficiency of energy use over time (we've gone from the muscle age to the machine age since the 1600s), courtesy of the water wheel, the steam engine, etc. We may also say it's due to the other factors of production, such as geography, where countries which lacked for reliable sources of water ended up getting short shrift from the industrial age when competitors appeared that, having relied on the "worse" water wheel due to natural waterways presence, ended up overtaking them dramatically due to developments of future technologies (i.e. electricity).
Of course, the last case is that of the United States, a veritable industrial backwater in 1800, becoming the preeminent industrial power of the globe by 1900; versus the United Kingdom, which had undergone the inversion. One of the main theories for why this occurred is because British industry tended to be focused around disparate cottage industries (made possible by the relatively portable steam/coal engine) connected by railways, while the United States had to make do with large, contiguous industrial zones near waterways. In the short term, the UK outproduced the United States because it could move goods about as fast as a waterway, and there aren't many waterways in the U.S. to compete with the railroad, but in the long term they shot themselves in the foot since when the USA was able to produce motive power irrespective of water power, in the form of electricity, it had experience and industrial/organizational expertise needed to produce Fordist megafactories. The UK had skilled ateliers, which although individually productive and ingenious, conferred no advantages (and many disadvantages) in an age where the limiting factor was now communications distance between workers and factory designers.
Of course, slavery oriented societies have less initiative to invent machines. But those who hadn't done it wouldn't have gone to the space.
The last seriously important slave economy to exist was Nazi Germany. They did not lack for initiative, and they probably would have existed long enough to go to space (arguably, they already did, since V-2 rockets breached the Karman Line at least once). I'm not sure what you're arguing here besides conflating Stellaris with some view of the actual 23rd century, though.
I'm just trying to inject realism into the game because suggesting to make games "more realistic" is my raison d'etre.
That, and having slave economies require different materials for maintaining their jobs would make sense, since they shouldn't produce a lot of money/energy to begin with. It would also be an interesting mechanic, since as it stands, slave economies and free economies are basically the same thing, except slave economies are better because they can achieve autarky more readily in line with the general playstyle of "paint the map <color>".
Not enough to be OP, but enough to make the skill floor and effort required to win as them much lower than that of free economies. Stack food/mine/energy districts at the start, then shift to building clerk jobs, and set your trade policy to produce CGs. You are done until you need to expand your clerk buildings to the next tier, but you can easily plan for this by having crystal fabricators or mines build ahead of the expansion and putting specialists in there. Combined with the tech benefits of slaves in general you will usually outproduce anyone you come across of equal size unless they are also a slave economy.
Once you've colonized about a dozen 20-25 size planets like this, you should be big enough to become a complete autarky. A little foresight is needed to make it work, but it's only the three basic resources you're looking at, plus trade value (which can be attained simply by spamming commercial buildings), but it's not difficult at all to start producing, at or near 1K food/minerals/energy/CGs, around 2300-2350. Earlier perhaps if you get a lucky starting position.
There's no serious downside to picking slavery, basically.