If the first school offer you the job, and you think you would prefer the second job if it was offered, I’d advise saying you would just like a day to think about it. If they ask you why, you could be honest. Headteachers know this happens, because teaching interviews tend to take place bunched into a short space of time each term because of the required limiting dates for giving notice.
Tell them you don’t want to mess them about - they ought to appreciate that.
If you accept the job and then go back on it, it can create havoc in schools because by the time you tell them you’ve changed your mind and don’t want the job, they may already have told the other candidates they were unsuccessful. It would probably mean the school would never consider you for a job again, and is the sort of information school leaders often share informally.
However, no headteacher is going to feel flattered that you would really prefer the other job if it is offered, so you need to be sure that it’s worth you running the risk of it putting them off you.
As an HT I used to ask interview candidates openly whether they had any other interviews lined up in the near future - not sure if I should have done, but it certainly concentrated the mind! If they said yes, I explored further which job they would really prefer. Sometimes it was just about distance from home, but sometimes it was about something the other school was offering and I could then offer too.
I’m not sure, though, how you’re going to tell from an interview which school you would prefer - I would have thought you’d learn more from looking round both schools before the interview day, talking to staff etc. and make up your mind beforehand.