There are still a few interesting things to say about this question, so I thought I'd add some comments.
In one sense, the answer to the question of when a Riemannian metric has an orthonormal coframing that diagonalizes the curvature in the manner requested by the OP is an algebraic problem: As is well-known, the space of curvature tensors (when regarded as quadratic forms on $\Lambda^2$ that satisfy the first Bianchi identity) has dimension $D_n = \tfrac{1}{12}n^2(n^2{-}1)$, while the set of those diagonalizable in some orthonormal coframe is the $\mathrm{O}(n)$-orbit of a linear subspace of dimension $\tfrac{1}{2}n(n{-}1)$, so (when $n\ge 3$) it is a cone $\mathcal{R}_n$ of dimension $n(n{-}1)$. Thus, a Riemannian metric will have to satisfy a set of at least
$$
R_n = \tfrac{1}{12}n^2(n^2{-}1) - n(n{-}1) = \tfrac{1}{12}n(n{-}1)(n{-}3)(n{+}4)
$$
polynomial relations on its curvature in order for such a diagonalization to be possible at every point. Writing out a set of generators for these relations is not likely to be easy and probably won't be enlightening, even for $n=4$, which is when it first becomes nontrivial. Moreover, there is no guarantee that this ideal $\mathcal{I}_n$ of polynomial relations is generated by only $R_n$ polynomials or that you won't still have to impose some inequalities to make sure that the curvature is diagonalizable by an element in $\mathrm{O}(n)$ rather than by an element of $\mathrm{O}(n,\mathbb{C})$ that doesn't lie in $\mathrm{O}(n)$. However, this approach would, in theory, give the answer to the OP's literal question.
On the other hand, one might want to interpret the question as asking how one could 'generate' all of the metrics that satisfy this diagonalizability property, at least locally. This is a more interesting (and more challenging) problem. Willie and Thomas have each given examples of classes of such metrics that essentially depend on one function of $n$ variables: Willie cited the conformally flat metrics, which are locally of the form $e^u g_0$ where $g_0$ is the standard metric on $\mathbb{R}^n$, and Thomas cited the induced metrics on hypersurfaces in a space form of dimension $n{+}1$, each of which, locally, can be described as the graph of one function of $n$-variables). The interesting question is whether these are, themselves, special cases of some more general class of metrics with the desired property. Might there be a class of examples that depend on more than one arbitrary function of $n$ variables? Another interesting question is whether their examples 'reach' all the curvature tensors that satisfy the relations $\mathcal{I}_n$ and, if not, whether are there other examples that do.
This latter question is easier to answer than the former. It is easy to see, just by an algebraic count, that neither the conformally flat metrics nor those induced on hypersurfaces in space forms can actually `reach' all of the $\mathrm{O}(n)$-orbits in $\mathcal{R}_n$. (The two sets of orbits that they reach overlap, and they are distinct, proper closed subsets of $\mathcal{R}_n$.) On the other hand, examples provided by É. Cartan of nondegenerate submanifolds of dimension $n$ in $\mathbb{R}^{2n}$ that have flat normal bundle turn out to have their curvature tensors in $\mathcal{R}_n$ and, using these, one can reach an open subset of the orbits in $\mathcal{R}_n$. Now, Cartan's examples depend locally on $n^2{-}n$ arbitrary functions of two variables (not $n$ variables), and it turns out that they satisfy many more differential equations (of higher order) than just the $\mathcal{I}_n$. For example, in Cartan's examples, the diagonalizing coframing $\omega=(\omega_i)$ turns out to be integrable, i.e., $\omega_i\wedge d\omega_i = 0$ for all $i$, so that the metric itself can be diagonalized in a local coordinate chart and thus is locally of the form
$$
g = e^{2f_1}\ {dx_1}^2 +e^{2f_2}\ {dx_2}^2 + \cdots + e^{2f_n}\ {dx_n}^2.
$$
Meanwhile, the condition for a metric in this form to have its curvature tensor be diagonal with respect to the coframing $\omega = (\omega_i) = (e^{f_i}\ dx_i)$ and, hence, take values in $\mathcal{R}_n$ turns out to be an involutive system of second order PDE for the functions $f_i$ whose general local solution depends on $n^2{-}n$ arbitrary functions of two variables. These turn out to be slightly more general than the ones that arise as Cartan's examples, and, using solutions of this type, one can reach all of the $\mathrm{O}(n)$-orbits in $\mathcal{R}_n$.
However, the question of how to 'generate' the 'general' metric whose curvature tensor takes values in $\mathcal{R}_n$ for $n\ge 4$ seems to be a very difficult problem. It is an overdetermined system for the metric that is not involutive, and computing its first two prolongations, even in the $n=4$ case, yields a system that is extremely algebraically complicated and still not involutive. Thus, I do not know (and I believe that it is not known) whether the general local solution of this problem depends (modulo diffeomorphism) on more than one arbitrary function of $n$ variables.