Jack,
It is hard to make such decisions based on the comments on an online forum, this one included. Everyone has their own opinions and mostly have reasons to support them. But it does not mean that they are correct 100% of the time or they are correct in your particular situation.
I remember being on online forums for stock investing for the first time and was looking for how to get started. It was the same, actually it was worse because i think BiggerPockets has one of the best forums. Everyone kept saying stack your emergency funds, pay your debts, do all the other stuff and come back here next year and still get the same advice.
I think you have two very good options. If you pay your student loan, you will be debt free and would not have to worry about a nonperforming debt anymore. But if you chose to invest that in real estate instead, you will start on real estate game early and will start your journey towards long term wealth building. None of these are bad options. In a grand scheme of your lifetime, $8000 or a year of (non) investment is not a big deal. I am assuming you will be able to save at least 8000 in a year with your 40000 income. Do what your gut feeling tells you to do and you will be fine either way.
Just because you are in this forum instead of car-shopping or finding other ways of lifestyle inflations, means that you in better situation than average people. Good luck!