Here's how Communism would make sense in that instance: With replicators- true replicators- the only input to create physical goods of ANY type is energy.
Which means there are only two things any human being would need- time and energy. Everything else can be made on the spot.
Time, well, God is a socialist when it comes to time. We are each allocated exactly 24 hours a day, no more, no less. There is nothing we can do to change the length of a day by a single instant.
Centralized power production on a grid system by the Government, with the Government owning the power plants, is such a natural monopoly that we already do it in one form even in capitalist nations- the government grants the power company a complete monopoly in a given area, usually overseen by some sort of utility board. A thin veneer of billing for energy used pays for it (supposedly), but in reality, balancing the grid is a 24x7x365 job; and you are allocated your connection to the total energy in the system.
The alternative, once replicator technology is available, is distributism and this is also seen occasionally in Star Trek, usually anti-social types who find a nice deserted hunk of rock to settle on for whatever reason (research?) visited only by the occasional passing starship. Of course, one might say that they're a commune of one (one individual, one family) and are their own government; it falls on them to generate their own energy somehow. And that's so OK with the Federation Communists that they only bother such settlements when war approaches or if they're endangering some other native population. If you have an entire universe to expand into and the means to do so, land isn't scarce anymore either.
The only thing I can't figure out is how Jean Luc's brother Robert is able to find customers for more than one bottle of wine a vintage. Seems to me it would be drop dead simple to feed a bottle into a transporter to generate a replicator pattern and have an infinite number of bottles available.