The youth hostel seems a bit expensive (300 NOK/night) so I was wondering if it's possible to camp in or near Longyearbyen. Can you be sure polar bears never go into town? On the other hand, perhaps it would be more fun to stay at the youth hostel where you would meet some other people and it's more comfourtable to sleep there. Perhaps they can offer cheaper week deals?

I've never been on Svaldbard myself, but the rules applying to Svalbard is different from rest of Norway. It isn't even a democracy. I think you need to have a safety course to camp on your own, and i think you also need to have a gun and flares etc to camp legally.
You can read more on the Govenor of Svalbard's homepage.

From memory, there was a campsite there, but in my opinion it's worth paying a bit extra for a hostel. I stayed at the Spitsbergen Guesthouse and had a 3 bed dorm to myself for the entire 5 nights! Also the buffet breakfast was superb and I ate that much that I didn't bother buying anything for lunch, so in that respect I saved some money...
Have fun! I also want to go back when I can afford to do the multi-day cruise...
Rich