It's no different than building a new pc. You need to buy a copy of 8.1 from microsoft (or your favorite pc parts house) and do a fresh install.
but how would i do it (sorry im a noob at this kind of thing). If i have no os after installing new mobo then how would i install a new one. Is it inserting a disc?