Yo. I know how it feels to fail an exam like that, because I'm also in Prelims. Failing one test really has affected me in my others. But look at the weighting of your exam. Is it huge? Its stressful, but learn where you made your mistakes, and don't make them again. No it wont affect your atar.
I failed a maths exam, well, technically I just passed - I got 50%. the average was 35%. So when it came to my physics test I couldn't rid the train of thought that I was going to fail that too.
what I'm saying is , stop stressing over it. Because once you do, you're directing all of that energy into frustration and anger and you'll havE none remaining to study.
If you studied hard but you failed your exams, then you must not have studied thoroughly enough. Refer to the syllabus of your subjects and make sure you're covering all the content.
Other than that, have fun because that's what'll keep you going. Good luck ! :)