Different theoretical and laboratory studies on the propagation of elastic waves in real rocks have shown that the presence of heterogeneities larger than the pore size but smaller than the predominant wavelengths (mesoscopic-scale heterogeneities) may produce significant attenuation and velocity dispersion effects on seismic waves. Such phenomena are known as “mesoscopic effects” and are caused by equilibration of wave-induced fluid pressure gradients. We propose a numerical upscaling procedure to obtain equivalent viscoelastic solids for heterogeneous fluid-saturated rocks. It consists in simulating oscillatory compressibility and shear tests in the space-frequency domain, which enable us to obtain the equivalent complex undrained plane wave and shear moduli of the rock sample. We assume that the behavior of the porous media obeys Biot's equations and use a finite-element procedure to approximate the solutions of the associated boundary value problems. Also, because at mesoscopic scales rock parameter distributions are generally uncertain and of stochastic nature, we propose applying the compressibility and shear tests in a Monte Carlo fashion. This facilitates the definition of average equivalent viscoelastic media by computing the moments of the equivalent phase velocities and inverse quality factors over a set of realizations of stochastic rock parameters described by a given spectral density distribution. We analyzed the sensitivity of the mesoscopic effects to different kinds of heterogeneities in the rock and fluid properties using numerical examples. Also, the application of the Monte Carlo procedure allowed us to determine the statistical properties of phase velocities and inverse quality factors for the particular case of quasi-fractal heterogeneities.