The Description given in trek is that all waste organic or otherwise is processed via the ships transporters and replicators and stored aboard ship in a inert form. when a object is ordered it is assembled by reorganizing the matter at the molecular level. Translation Super Scifi Alchemy.
But don't get to hung up on that. TOS seemed to use prepackaged and on ship prepared foods using onboard conventional stores
Enterprise A had a kitchen
And a hydroponics is mentioned a number of times of TNG
on DS9 Sisco is stated as growing his own vegetables
and on Voy 7of9's cargo bay has a number of plants growing in hydroponics
Enterprise has repeated mentions of stasis pods of food and a cook aboard. Trip states that the waste materials are used for boots and uniforms meaning it's used to create a rapid prototyping raw material.
A few years back there was Talk of a number of processes to convert waste using microbes and fungi.