The following analysis shows that the Biblical story must have been the original and Gilgamesh borrows from it.
"From the early days of the comparative study of these two flood accounts, it has been generally agreed that there is an obvious relationship. The widespread nature of flood traditions throughout the entire human race is excellent evidence for the existence of a great flood from a legal/historical point of view.20 Dating of the oldest fragments of the Gilgamesh account originally indicated that it was older than the assumed dating of Genesis.21 However, the probability exists that the Biblical account had been preserved either as an oral tradition, or in written form handed down from Noah, through the patriarchs and eventually to Moses, thereby making it actually older than the Sumerian accounts which were restatements (with alterations) to the original."