(slightly expanded and edited version of comments)
Maybe write something brief that says initially you were studying statistics based on what you had been told about its marketability, but in doing this you seriously misjudged your interest in statistics and failed to pass your doctoral qualifying exam (i.e. Stat 501 — Doctoral Research Skills). Then say that you learned from this experience that, for you, it is more important to pursue what you truly like, which is mathematics.
You’ll want to minimize verbiage in discussing this, so resist the temptation to write another sentence that makes the “qualifying exam / course” relationship more explicit than given by the parenthetical i.e. part. Proceed immediately to your strong points relevant to the program you are applying to by providing statements that give evidence you can succeed in THEIR program, and don’t dwell on statements that give reasons for your failure in ANOTHER program.
In a comment you asked about saying the following: “Since I was unable to attend the class presentation and had already missed the deadline to drop the class, I ended up failing the STAT 501. Also, STAT 501 is a course on applied statistics, and I struggled with the statistical way of thinking due to my lack of prior experience with applied statistics.”
I think it would be best NOT to delve into such reasons. For example: (1) "unable to attend the class presentation" — This raises the question of why you were unable to attend. Moreover, if there is a legitimate reason for why you couldn’t attend, then this raises another question, namely why you were not otherwise accommodated regarding the class/qual-exam. (2) "missed the deadline to drop the class" — This introduces another failure on your part, that of not keeping up with deadlines. (3) "lack of prior experience with applied statistics" — This suggests a weakness in being able to independently learn necessary background knowledge in something, which you don't want to convey when applying to a Ph.D. program.
In summary, briefly acknowledge your failure and what you learned from it. However, don’t continue by providing more details and explanation, as this is wasting their time (they want to know whether you can succeed in THEIR program, not whether you could have succeeded “if only . . .” in some OTHER program) and this could introduce unintended suggestions of possible shortcomings that would be of concern to them.
Naturally, in a more extended in-person or video interview, you could go into more detail, but even then do so carefully — you’ll make a better impression by owning up to your mistakes/shortcomings than by trying to explain them away.