When an action is dismissed from any court for want of jurisdiction or because it has not been transferred regularly from an inferior to a superior court, the costs must be adjudged against the party attempting to institute or bring up the action.
N.D.C.C. § 28-26-12