Composting of two types of sludge produced in wastewater treatment plants, raw sludge (RS) and anaerobically digested sludge (ADS), has been systematically studied by means of the experimental design technique. The results have been analyzed using a full factorial experimental design in order to determine the optimal conditions for composting such sludges in terms of bulking agent particle size and bulking agent:sludge volumetric ratio, two of the key parameters to ensure an optimal performance of the composting process. The objective function selected was a simulated death kinetics of Salmonella, which was chosen as a model pathogen microorganism to represent the disinfection of the material. For both types of sludge, optimal values were found at 5mm bulking agent particle size and 1:1 bulking agent:sludge volumetric ratio when a Gaussian function was fitted to the experimental data. Pilot scale experiments using optimal values obtained were successfully undertaken and confirmed a full disinfection of the sludge by means of the composting process. A mathematical model to simulate the disinfection performance of a composting material is presented. The model can be applied to simulate the disinfection performance of a given pathogen.