We aim at determining the spatial distribution of the gas and dust in star-forming regions and address their relative abundances in quantitative terms. We also examine the dust opacity exponent beta for spatial and/or temporal variations. Using mapping observations of the very dense rho Oph A core, we examined standard 1D and non-standard 3D methods to analyse data of far-infrared and submillimeter (submm) continuum radiation. The resulting dust surface density distribution can be compared to that of the gas. The latter was derived from the analysis of accompanying molecular line emission, observed with Herschel from space and with APEX from the ground. As a gas tracer we used N2H+, which is believed to be much less sensitive to freeze-out than CO and its isotopologues. Radiative transfer modelling of the N2H+(J=3-2) and (J=6-5) lines with their hyperfine structure explicitly taken into account provides solutions for the spatial distribution of the column density N(H2), hence the surface density distribution of the gas. The gas-to-dust mass ratio is varying across the map, with very low values in the central regions around the core SM 1. The global average, =88, is not far from the canonical value of 100, however. In rho Oph A, the exponent beta of the power-law description for the dust opacity exhibits a clear dependence on time, with high values of 2 for the envelope-dominated emission in starless Class -1 sources to low values close to 0 for the disk-dominated emission in Class III objects. beta assumes intermediate values for evolutionary classes in between. Since beta is primarily controlled by grain size, grain growth mostly occurs in circumstellar disks. The spatial segregation of gas and dust, seen in projection toward the core centre, probably implies that, like C18O, also N2H+ is frozen onto the grains.