How do you know that you will fail? If you don't show up, you will almost certainly fail. If you do show up, and it so happens that you can manage the exam, you may end up passing.
Unless you are clinically depressed, you will almost certainly fail the course if you don't sit the final exam. That may have further implications if you fail another course, such as being put on Probation for your academic standing.
If you are clinically depressed, and you have been to the doctor, then you may apply for special consideration, whether to withdraw from the course completely, or if you do sit the exam, then possibly request for measures to counter your poor performance due to your depression.