Q. Is it possible or legal to deduct the 2024 tuition fee from the scholarship amount she gets in 2025 in order to get the AOTC in the 2025 tax return?
A. No. It must be claimed in the year paid.
So, yes, it was possible to claim in on the 2024 return, since it was paid in 2024 (for the first quarter of 2025), if she was otherwise qualified (there are restrictions on students under 24 getting the refundable portion and restrictions on non citizens/non residents).