Once more, with the last erg of feeling. It is safer to build in space than on Earth, unless you've got everybody with their own personal antigrav rig. It is probably faster too, because you're working in microgravity and only have to worry about inertia mass and not the one gee going DOWN. Plus zero-gee fab offers all sorts of possibilities.
Space is not "safer" to work in. . . there is cosmic weather, radiation, micro-meteors, that whole "no oxygen" thing, wearing uncomfortable, and mobility limiting, suits in order to work, etc.. . . plus, if the workers slightly misaligned say a bulkhead in microgravity, only to discover it when the artificial gravity is turned on, it would wipe out months of work in an instant: that won't happen when the ship is built in the gravity that it is going to work under; plus humans are fairly comfortable with gravity, considering that we evolved with it and all, it makes sense that we would actually work better in our native environment. . .as BillJ has said, the Federation has tractor beams and antigravity. . . there would be no problem getting a ship built on Earth into space. . .
EDIT: I see someone said it more eloquently than I did. . .