You wouldn't necessarily need to setup a 301 redirect to do this - we can set the canonical URL to the www for you.
However, we'd first want a bit more information on why exactly you'd be looking to do this? What is the issue with the root domain being indexed / what issues are you facing exactly with the root domain being accessed?