This paper presents the three-dimensional discrete element method (DEM) that was used to study the shear behaviour of fresh and coal fouled ballast in direct shear testing. The volumetric changes and stress-strain behaviour of fresh and fouled ballast were simulated and compared with the experimental results. 'Clump logic' in Particle Flow Code (PFC3D) incorporated in a MATLAB Code was used to simulate irregular shaped particles in which groups of ten to twenty spherical balls were clumped together in appropriate sizes to simulate ballast particles. Fouled ballast with various Void Contaminant Index (VCI), ranging from 20%VCI to 70%VCI, were modelled by injecting a specified number of miniature spherical particles into the voids of fresh ballast. The DEM simulation captures the behaviour of fresh and fouled ballast as observed in the laboratory showing that the peak shear stress of the ballast assembly decreases and the dilation of fouled ballast increases with an increasing of VCI. Furthermore, the DEM also provides insight to the distribution of contact force chains and particle displacement vectors, which cannot be determined experimentally. These micromechanical observations clearly justify the formation of a shear band and the evolution of volumetric changes during shearing. The reduced maximum contact force associated with increased particle contact area due to fouling explains the decreased breakage of fouled ballast. An acceptable agreement was found between the DEM model predictions and laboratory data.