Rhythm is more about feel than rules. Drum patterns are certainly all about rhythm. From your question I get that you are not a drummer. If you know a drummer, they might be able to help you by playing along with your melody.
If you don't have a drummer available, you can select a pattern from your library. While there are no rules per se in choosing a drum pattern, there are some ways to start narrowing down the possibilities.
One place to start in narrowing down potential drum patterns from your library to find drum patterns that will fit you song - is with the songs basic time signature. In other words, if your melody is in 4/4 time (which would be 4 beats per measure) then you will most likely want a drum pattern based on 4 beats per measure. If the melody you create is for 3/4 time, you want a drum pattern that works for 3 beats per measure.
Next you need to choose a tempo (number of beats per minute). One way to decide what tempo you want to record your melody at is to use a basic metronome track or simple click track that matches the meter of your song. Then play around with different tempos until you decide what works best with what you have in mind for your melody. Sing the melody out loud or play it on an instrument as you try different tempos.
The next step now that you have narrowed things down a bit, is simply to go through the patterns in your library with the tempo set appropriately - while singing the melody in your head (or out loud), and write down which patterns you can actually sing the melody to using the meter you had in mind as far as where the accents of the melody fall.
As you go through these patterns at a particular tempo, keep in mind that a given pattern might work at a different tempo than what your metronome test indicated. You can try a faster beat at half speed or a slower beat at double the speed. In other words, if you had decided on 80 beats per minute, you might find a drum pattern that works at 40 BPM or 160 BPM that does not work as well at 80 BPM.
After you narrow it down this way, go back and listen again to each of the patterns that seem like they might work, and narrow it down further. Then try playing your melody or singing your melody to the two or three patterns than are left until you identify one that sounds best to you.
Each pattern will lend a different feel to the song - but only you will know what feels best based on the melody that you conjured up in your mind.
Once you have chosen a basic pattern, you can play around with variations to that pattern or accent beats or fills or intros or transitions - to customize your drum track. If you later choose to notate the drums on your sheet music, you can play the melody over the drum pattern and record both at the same time - and then play back your recording at super slow speed to aid in transcription of the drum notation.
Have fun with your composing.