3 improved clarity of exposition and fixed a slight error

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 $R_n$ \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$. (In fact, these The two sets of orbits that they reach do overlap, but 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 every orbit an open subset of the orbits in$\mathcal{R}_n$. HoweverNow, 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$R_n$equations on the curvature. (\mathcal{I}_n$. For example, in Cartan's examples, the diagonalizing coframe 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 , i.e., it 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.$$ ConverselyMeanwhile, the condition for such a metric in this form to have its curvature tensor be diagonal with respect to the coframing $\omega_i \omega = e^{f_i}\ dx_i$ (\omega_i) = (e^{f_i}\ dx_i)$and, hence, lie 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. Using 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$.)\mathcal{R}_n$.

However, the question of how to 'generate' the 'general' metric whose curvature tensor lies takes values in $\mathcal{R}_n$ for $n\ge 4$ seems to be a very difficult problem. It's 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.

2 fixed some typos and added information

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 the this ideal $\mathcal{I}_n$ of polynomial relations is generated by only $R_n$ relations polynomials or that you won't still have to impose some inequalities to make sure that the element 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)$. This However, this approach would, howeverin 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 Richard 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 Richard Thomas cited the induced metrics on hypersurfaces in a space form of dimension $n{+}1$ (which, n{+}1$, 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 a some more general class of metrics with the desired property. Might there be a class of examples that depend on more then than one arbitrary function of$n$variables? Another interesting question is : Do whether their examples 'reach' all the curvature tensors that satisfy the relations$R_n$and, if not, then 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$. (In fact, the these two sets of orbits that they each reach do overlap, but they are distinct, proper 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 also turn out to have their curvature tensors in$\mathcal{R}_n$and, using these, one can reach every orbit of$\mathcal{R}_n$. However, 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$R_n$equations on the curvature. (For example, in Cartan's examples, the diagonalizing coframe$\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, i.e., it 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.$$ Conversely, in order the condition for such a metric to have its curvature tensor be diagonal with respect to the coframing$\omega_i = e^{f_i}\ dx_i$and, hence, lie 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.)variables. 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 lies in$\mathcal{R}_n$for$n\ge 4$seems to be a very difficult problem. It's 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. 1 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 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 the ideal of polynomial relations is generated by only$R_n$relations or that you won't still have to impose some inequalities to make sure that the element 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)$. This would, however, 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 Richard 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 Richard cited the induced metrics on hypersurfaces in a space form of dimension$n{+}1$(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 a more general class of metrics with the desired property. Might there be a class of examples that depend on more then one arbitrary function of$n$variables? Another interesting question is: Do their examples 'reach' all the curvature tensors that satisfy the relations$R_n$and, if not, then 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$. (In fact, the sets of orbits that they each reach overlap but are distinct, proper 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 also have their curvature tensors in$\mathcal{R}_n$and, using these, one can reach every orbit of$\mathcal{R}_n$. However, 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$R_n$equations on the curvature. (For example, the diagonalizing coframe$\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, i.e., it 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.$$ Conversely, in order for such a metric to have its curvature tensor lie in$\mathcal{R}_n$turns out to be an involutive system of PDE for the functions$f_i$whose general local solution depends on$n^2{-}n$arbitrary functions of two variables.) However, the question of how to 'generate' the 'general' metric whose curvature tensor lies in$\mathcal{R}_n$for$n\ge 4$seems to be a very difficult problem. It's 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.