The basic reproduction number, simply denoted by $R_0$, plays a fundamental role in the analysis of population and epidemic models. However in mathematical modelling the specification of the input parameters can be crucial since, due to some limitations in experimental data available, they can be uncertain and often represented as random quantities in a suitable probabilistic framework. In this context the Polynomial Chaos Expansions (PCEs), coupled with suitable numerical methods, furnish important tools for the sensitivity analysis (SA) and the uncertainty quantification (UQ) of the random model response. The aim of this paper is to describe how the variability of $R_0$ is affected by the variability of the input parameters, through the evaluation of Sobol' indices by PC-based methods. The use of a suitable and new computational model of $R_0$ allows also to consider more complex epidemic models, where $R_0$ is defined as the spectral radius of the infinite-diminensional next generation operator. The efficiency and versatility of the numerical approach are confirmed by the experimental analysis of two examples of increasing complexity.