Yes you can pay back your Stafford loan while you are in school and before you enter the mandatory repayment phase. And the interest rate is fixed, so it won’t change based on if you pay it back in 5-6 months vs. the 10 year maximum.
The only question is why? Why are you taking out a loan if you are only going to pay it back in 5-6 months? If you can afford to, I would suggest just paying the balance due to your school and not taking out the loan.
If you have to take out the loan to cover the balance for a few months, then fine. But no sense in taking on debt only to pay it back so quickly if you do not have to.