Mathematical modeling of spatio-temporal population dynamics and application to epidemic spreading