Determining magnetic field properties in different environments of the cosmic large-scale structure as well as their evolution over redshift is a fundamental step toward uncovering the origin of cosmic magnetic fields. Radio observations permit the study of extragalactic magnetic fields via measurements of the Faraday depth of extragalactic radio sources. Our aim is to investigate how much different extragalactic environments contribute to the Faraday depth variance of these sources. We develop a Bayesian algorithm to distinguish statistically Faraday depth variance contributions intrinsic to the source from those due to the medium between the source and the observer. In our algorithm the Galactic foreground and the measurement noise are taken into account as the uncertainty correlations of the galactic model. Additionally, our algorithm allows for the investigation of possible redshift evolution of the extragalactic contribution. This work presents the derivation of the algorithm and tests performed on mock observations. With cosmic magnetism being one of the key science projects of the new generation of radio interferometers we have made predictions for the algorithms performance on data from the next generation of radio interferometers. Applications to real data are left for future work.