It’s from Part VII of “Fictitious Splits in the International” drafted by Marx and Engels in 1872 which
can be found here.
Here’s the quote:
All socialists see anarchy as the following program:
Once the aim of the proletarian movement — i.e., abolition of classes — is
attained, the power of the state, which serves to keep the great majority
of producers in bondage to a very small exploiter minority, disappears,
and the functions of government become simple administrative functions.