Simply put, Rodenberry didn't like robots. Robots, robotic technology and "self-aware" machines were a bugaboo for Gene Rodenberry's idea of the future. There are very few episodes where self-aware machines or even dumb robots were in place instead of human effort. Rodenberry believed in the idea of an empowered and enlightened Human future. Just because you CAN build androids, doesn't mean you should.
It's not just starships, I imagine most things in the Federation are replicated and then put together with human effort. People don't HAVE to work, but there's nothing saying they might not WANT to. Robots remove labor from the workforce (as we can see on Earth already) but when people are unemployed and there is still a profit engine, unemployment means disenfranchisement.
- I also can't believe, given the scale of starships, some sort of limited robotic support isn't used to do at least some of the work. On modern era ships, cables are run by humans, but I can imagine smaller, limited intellect/or remote controlled robots being used for work such as that; cables, pipes, conduit, manifolds, all kinds of piping could be run and maintained by small robots we just aren't privy to.
When Lily Sloane asked how much the USS Enterprise-E cost to build, Picard tells her "The economics of the future is somewhat different. You see, money doesn't exist in the 24th century... The acquisition of wealth is no longer the driving force in our lives. We work to better ourselves and the rest of Humanity." (Star Trek: First Contact)
In a future without money, employment is opportunity to do something new, different, interesting and something you want to do everyday, because you want to. No one works a dead end job in the Federation, because, presumably, everyone is doing what they would LIKE doing.
When Nog suggests that Jake should bid for a baseball card in an auction, Jake says "I'm Human, I don't have any money." Nog replies "It's not my fault that your species decided to abandon currency-based economics in favor of some philosophy of self-enhancement." Jake says "Hey, watch it. There's nothing wrong with our philosophy. We work to better ourselves and the rest of humanity." Nog then replies "What does that mean?" Jake responds "It means we don't need money!" Nog quickly points out, however, that Jake wouldn't be able to bid or borrow. (DS9: "In the Cards")
Part of the lack of robots may have been what might have been, at the time, a complete inability to imagine things like robotic assembly lines in place today, or perhaps it was a cultural ideal that humans would want to create their machines and devices in the future, the same way we do today.
As Star Trek progressed, ideas which were verboten in the past, slowly made their way into the stories of the modern era, i.e. Data, a self-aware android, unique and allowed to serve in Star Fleet. Technically he and his "brothers" wasn't the first self-aware machine we are exposed to, Harry Mudd, discovered an entire planet of client-server humanoids with some degree of awareness.
The first truly successful androids in the Federation were the Soong-type androids created by Doctor Noonien Soong. Most notable of these was Lieutenant commander Data, who served as operations officer on board the USS Enterprise-D and USS Enterprise-E. (Star Trek: The Next Generation)
- We know this means the Federation has been exposed to robotic/android technology since the TOS era. We also know the Federation rarely seems to partake of it (on screen). This does not mean there aren't industrial robots working those industrial replicators, only that we are not privy to their operation.
The androids of the planet Mudd originated in the Andromeda Galaxy. They were constructed by an unnamed humanoid species for the purpose of performing necessary service functions, freeing their makers to evolve a perfect social order. Using a combination of irrational behavior and logical paradoxes, the androids were eventually overcome by the Enterprise crew with the assistance of Harry Mudd. With the androids incapacitated, it became possible for the Starfleet personnel to reprogram the androids to continue once again the project they had been sent to the planet to accomplish. (TOS: "I, Mudd"; TNG: "Conspiracy")
This means the Federation understood robotics/android well enough to use and reprogram the Mudd series of androids but had no interest in exploiting them for their labor. Given their strength and durability, they might have been excellent, if limited assets, working in Federation space. Instead, the Federation routed traffic away from Planet Mudd.
Perhaps industrial robots/replicators are a state secret, or are only used in extremis, say when the Federation needs to crank out dozens of ships/fighters/shuttlecraft/photon torpedoes at a time.
We know the Federation uses replicators to create a great deal of their ships components and subsystems; tritanium hulls, bulkheads, power plants, fundamental EPS and computer/tricorder technology and the like. Depending on the device and its energy or complexity requirements, many things may be able to be replicated fully or in part.
This isn't just a Federation issue. None of the Alpha Quadrant species seem particularly fond of robotic help beyond the use of "smart systems" on their starships. Perhaps its a psychological issue, perhaps it keeps people working, perhaps it's an issue of trust of machines or their inability to keep them secure enough from hacking, viruses and the distribution of malware.
Look at it this way: given AI sophistication, if you used lots of robots and someone got on board your ship or in your station and could crack their defense codes, they would suddenly end up with a large number of robotic death machines which used to belong to you and now belong to your enemy. Perhaps the civilizations of the Alpha quadrant simply want to avoid such an unfortunate circumstance and keep people artistically employed.