Confusion matrix. "How close I am to the diagonal?". Is there such metric?
The classes that define the columns/rows can be arbitrarily rearranged. Therefore, the &quot;distance&quot; of a misclassification to the diagonal has no meaning. So no, there is no such metric.
I like @Dave's comment: &quot;Is it worse to call a dog a cat than it is to call a dog a horse?&quot;

Maybe you'd ask yourself, &quot;some classes feel closer together than others&quot;
For example, we could create a confusion matrix like this:
$ \begin{matrix}
&amp;&amp;&amp;&amp;PREDICTED\\
&amp;&amp;Person &amp; Woman &amp; Man &amp; Camera &amp; TV
\\
T&amp;Person &amp; 33 &amp; 5 &amp; 3 &amp; 0 &amp; 1
\\
R&amp;Woman &amp; 10 &amp; 50 &amp; 2 &amp; 22 &amp; 0
\\
U&amp;Man &amp; 12 &amp; 23 &amp; 47 &amp; 1 &amp; 13
\\
T&amp;Camera &amp; 4 &amp; 2 &amp; 7 &amp; 24 &amp; 9
\\
H&amp;TV &amp; 3 &amp; 5 &amp; 8 &amp; 13 &amp; 11
\end{matrix}$
(Where $Person$ denotes non-binary of course).
It feels like misclassifying $Camera$'s as $Woman$ should be &quot;more wrong&quot; than misclassifying $Man$ as $Woman$. After all, women aren't objects.
However, in the world of unfeeling classifiers, a &quot;woman&quot; has no meaning, and neither does &quot;object&quot;. Hence we call such classifiers &quot;tools&quot;.

Edit to address your comment:
In situations where there's some notion of distance, you'd use regression rather than classification. You can use regression even for discrete dependent variables. In other words, you need either numeric or ordinal data for distance to make sense.
To use the example in your comment of &quot;classifying&quot; a variable that represents performance:

Continuous: If you measure performance as a continuous variable, then it's clear to use regression.

Ordinal: But even if you measure performance on, say, an integer scale from 1-10, you can still regress the data. (As an aside, in practice, all measurements can be considered are discrete if you consider that they are limited by resolution/precision). You can also map ordered concepts to discrete but numeric values. For example, the Likert scale (Strongly Disagree, Disagree, Neutral, Agree, and Strongly Agree) can be mapped to integers 1-5. However, the reason you can't directly determine distance without mapping to numerical values is because there's no intrinsic distance between the nominal values. Strongly Disagree could be two units away from Disagree, and maybe Neutral is a billion units away from Agree.

Nominal: If you measure performance using words like &quot;good&quot;, &quot;decent&quot;, &quot;fine&quot; where there's no clear ordering, then distance makes no sense.