  In this work, we study an inverse problem of recovering a space-time
dependent diffusion coefficient in the subdiffusion model from the distributed
observation, where the mathematical model involves a Djrbashian-Caputo
fractional derivative of order $\alpha\in(0,1)$ in time. The main technical
challenges of both theoretical and numerical analysis lie in the limited
smoothing properties due to the fractional differential operator and high
degree of nonlinearity of the forward map from the unknown diffusion
coefficient to the distributed observation. We establish two conditional
stability results using a novel test function, which leads to a stability bound
in $L^2(0,T;L^2(\Omega))$ under a suitable positivity condition. The positivity
condition is verified for a large class of problem data. Numerically, we
develop a rigorous procedure for recovering the diffusion coefficient based on
a regularized least-squares formulation, which is then discretized by the
standard Galerkin method with continuous piecewise linear elements in space and
backward Euler convolution quadrature in time. We provide a complete error
analysis of the fully discrete formulation, by combining several new error
estimates for the direct problem (optimal in terms of data regularity), a
discrete version of fractional maximal $L^p$ regularity, and a nonstandard
energy argument. Under the positivity condition, we obtain a standard
$\ell^2(L^2(\Omega))$ error estimate consistent with the conditional stability.
Further, we illustrate the analysis with some numerical examples.
