  In this paper we investigate the moments and the distribution of
$L(1,\chi_D)$, where $\chi_D$ varies over quadratic characters associated to
square-free polynomials $D$ of degree $n$ over $\mathbb{F}_q$, as $n\to\infty$.
Our first result gives asymptotic formulas for the complex moments of
$L(1,\chi_D)$ in a large uniform range. Previously, only the first moment has
been computed due to work of Andrade and Jung. Using our asymptotic formulas
together with the saddle-point method, we show that the distribution function
of $L(1,\chi_D)$ is very close to that of a corresponding probabilistic model.
In particular, we uncover an interesting feature in the distribution of large
(and small) values of $L(1, \chi_D)$, that is not present in the number field
setting. We also obtain $\Omega$-results for the extreme values of
$L(1,\chi_D)$, which we conjecture to be best possible. Specializing $n=2g+1$
and making use of one case of Artin's class number formula, we obtain similar
results for the class number $h_D$ associated to $\mathbb{F}_q(T)[\sqrt{D}]$.
Similarly, specializing to $n=2g+2$ we can appeal to the second case of Artin's
class number formula and deduce analogous results for $h_DR_D$ where $R_D$ is
the regulator of $\mathbb{F}_q(T)[\sqrt{D}]$.
