
I would talk with your advisors first and see if either of those options would impact anything else. If you don’t need the class to graduate and can withdraw without it affecting GPA that might be a good option so you don’t have to rewrite everything, but if you do need it then you should probably be able to get your old grade replaced by the new one
withdrawing will look bad on your transcript if you plan to transfer to another school, and if it puts you below full-time credits it might impact any federal or state financial aid you received for the semester. failing would also look bad on your transcript and would bring your whole gpa down. like #1 said you should probably talk to your advisors, but personally i think it's generally better to withdraw than fail a class