When a divorce is granted for the adultery of the wife, the legitimacy of children begotten of her before the commission of the adultery is not affected, but the legitimacy of other children of the wife may be determined by the court upon the evidence in the case. In every such case, all children begotten before the commencement of the action are to be presumed legitimate until the contrary is shown.
N.D.C.C. ยง 14-05-21