Metrizability of a compact Hausdorff space whose diagonal is a zero set
$\newcommand{\cl}{\operatorname{cl}}$Suppose that the diagonal $\Delta$ in $X\times X$ is the zero set of a continuous non-negative function $f:X\times X\to\Bbb R$. (Continuity is essential.) For $n\in\Bbb N$ let $U_n=\{\langle x,y\rangle\in X\times X:f(\langle x,y\rangle)<2^{-n}\}$; clearly $U_n$ is open in $X\times X$. For each $x\in X$ and $n\in\Bbb N$ there is an open $B(x,n)\subseteq X$ such that
$$\langle x,x\rangle\in B(x,n)\times B(x,n)\subseteq U_n\;.$$
For each $n\in\Bbb N$ let $\mathscr{U}_n=\{B(x,n):x\in X\}$; $\mathscr{B}_n$ is an open cover of $X$, so there is a finite $F_n\subseteq X$ such that $\mathscr{B}_n=\{B(x,n):x\in F_n\}$ covers $X$. Let $\mathscr{B}=\bigcup_{n\in\Bbb N}\mathscr{B}_n$; then $\mathscr{B}$ is a countable family of open sets in $X$. I claim that $\mathscr{B}$ is a base for the topology of $X$; if so, then $X$ is a second countable compact Hausdorff space and is therefore metrizable by the Uryson metrization theorem.
Suppose that $V$ is a non-empty open set in $X$, and let $x\in V$. Define $f_x:X\to\Bbb R:y\mapsto f(x,y)$, and for $n\in\Bbb N$ let $G(n,x)=\{y\in X:f_x(y)<2^{-n}\}$. Suppose that for each $n\in\Bbb N$ there is an $x_n\in G(x,n)\setminus V$, and let $\sigma=\langle x_n:n\in\Bbb N\rangle$; then $\langle f_x(x_n):n\in\Bbb N\rangle\to 0$. $X$ is compact, so $\sigma$ has a cluster point $y$. Since $f_x$ is continuous, it’s easily checked that $f_x(y)=0$ and hence that $y=x$. But this is impossible: $V$ is an open nbhd of $x$ that contains no term of $\sigma$. This contradiction shows that there must be some $n\in\Bbb N$ such that $G(x,n)\subseteq V$. It follows that $\{G(x,n):n\in\Bbb N\}$ is a local base at $x$.
Now fix $x\in X$, and let $V$ be any open nbhd of $x$. There is an $n\in\Bbb N$ such that $G(x,n)\subseteq V$, and there is a $y\in F_n$ such that $x\in B(y,n)$. Suppose that $z\in B(y,n)$; then $$\langle x,z\rangle\in B(y,n)\times B(y,n)\subseteq U_n\;,$$ so $f_x(z)=f(\langle x,z\rangle)<2^{-n}$, and $z\in G(x,n)\subseteq V$. Thus, $x\in B(y,n)\subseteq V$, where $B(y,n)\in\mathscr{B}$, so $\mathscr{B}$ is indeed a countable base for $X$, and $X$ is therefore metrizable.
This should be well-known Šneider theorem asserting that a Hausdorff compact space with $G_\delta$-diagonal is metrizable (see, for instance, Gru, 2.13).
[Gru] Gary Gruenhage. Generalized metric spaces in Handbook of set-theoretic topology, ed. K. Kunen, J. Vaughan, North-Holland, 1984.