Starfleet don't pay.... so what do they use instead, is it all for the greater good?, if you want to setup a society what would you use instead, would people be content in making a difference for everyone and progressing the group, knowing that they will be fed, have clothing/accommodation, medical attention as an when required... would that be enough?
What motivation do you need to get out of bed, or do hobbies that no one pays you any money for?
What motivation do kids have for being inquisitive about the world around them when they constantly ask questions about things, being playful, etc?
Does someone pay you to read or to write the posts online? Yes, someone COULD (technically) do that, but the vast majority of people spend their time on these forums, do independent research on various topics (or at least stuff they are interested in when it comes to Trek), etc. is because they want to.
Do you need to get paid to ensure your own wellbeing or the wellbeing of others? Majority of people don't.
The same idea applies to Trek and Starfleet (or what Roddenberry originally envisioned when it comes to Humans not using money).
He based TNG somewhat on Resource Based Economy (or cybernation as it was called in the 70-ies), but the writers never fleshed it out completely because of wanting to make the show something existing humans in real life (aka average Americans) could somewhat relate to.
People are in Starfleet because they consider themselves explorers... its an option for them to go into the unknown, usually supported by other people who share a same/similar mindset.
On some level, people understand that exploring space can be incredibly dangerous... and while yes, you could probably do it alone, chances are you'd want the support of others who want to explore the unknown as well.
People really need to leave behind the notion that in order to be motivated to do something, you need to pay them (or generate incentive by money).
More often than note, people develop independent interests in real life that have nothing to do with money because its something that interests them and the only reason they do it is because they wish to become better at it (that's the proverbial 'award').
A lot of people in real life do a lot of things by asking nothing in return... they do them because they want to do them (and because they probably also have a life in which they don't usually need to worry about basic necessities.
There are hundreds of millions of volunteers around the globe today... which is ironic because Capitalism itself depends on those volunteers.
However, this isn't the same for most of society exactly because we live in a monetary world (aka, what you can do is dictated by how much money you actually have) and a lot of people are bogged down by worrying of having enough money to live on, the stress of paying bills, constantly worrying (in the back of your mind) if you have enough money to survive (this impedes ones ability to focus).
Majority of jobs in existence are garbage jobs that shouldn't even exist in the first place... they only exist to push money around for the sake of it... but are otherwise completely useless to advancing society or improving it.
Humanity is basically maintained by a proverbial handful of people and automation.
Scarcity is frequently quoted as an underlying notion for why we use the existing system... but that's been a long outdated nonsense because Humanity is in fact generating abundance (more than enough), and can do so sustainably... problem is that our social systems have decayed and not really advanced with science and technology and majority of the global population is not educated in scientific facts nor do they have a background in relevant general education.
We produce enough food to feed over 10 billion people and yet nearly half of the food produced is thrown out due to 'aesthetic standards' (otherwise, there's nothing intricately wrong - nutritionally speaking - with the food in question), or the feed is given to livestock (about 70% of globally produced soy goes to animals as their feed... not humans... only about 6% of globally produced soy is harvested for human consumption).
Then in the USA there's about 6 times more empty homes than there are homeless, and so on and so on.
People are incredibly uninformed about what we are doing in real life, and think you need a 'replicator' to ensure abundance (aka surpass scarcity)... no you don't.
You simply need the technical means to produce sustainable abundance (which we had for nearly 100 years now).
Since in Trek Humans aren't bogged down by money and worrying about survival (their needs being met), emphasis is made on self-improvement and betterment of mankind (the mindset of such a human would be a polar opposite to a human who was born and raised in a purely Capitalist system as it exists today.
That and, the less a human educates themselves in multiple subjects (aka they become say a specialist as opposed to a generalist), they will usually only be able to view the world through that limited lens and won't have much in the way of expanding this worldview without further expanding their knowledge-base.
In essence, Capitalism is a barbaric and outdated system... certainly not 'civilized' when you consider how many problems in the world stem from it (practically all of them).
At any rate, point being, motivation doesn't stem from money alone... in fact, money and 'prestige' are relatively speaking poor motivators, because for an educated human, those notions would be mostly meaningless.
What the heck is the point of acquiring status in society? In a completely free society, you'd have no such need, because the system would be set up in a way where this is completely unnecessary for anyone.
Trek has yet to show that actually... its still somewhat 'stuck' in the transitional period of RBE.
What doesn't sit 'right' with various people in real life is that they grew up in a society that works one way... only to be showcased something that's a polar opposite... and without a frame of reference (which is an abstract notion for most capitalists, it borderlines with the 'absurd' and being a 'pipe dream' - when in fact, they are the ones living in the absurd and have a pipe dream of 'infinite growth' on a finite planet that cannot possibly exist).