Problem: The Numbers text instructed that chastity be tested by drinking bitter water and seeing if the woman’s stomach would swell (see comments on Numbers 5:13–22). But, Deuteronomy 22 provides the blood stained sheet from the wedding night as evidence of virginity (cf. vv. 14–17).
Solution: The two situations are different. The Numbers passage is a test for alleged unchastity after marriage. And the Deuteronomy text deals with alleged unfaithfulness before marriage.