The chord progression you stated, I,II,IV,V, is very common in popular music, and you also let us know that you are playing this in the key of C major. As C is the tonic or root note in this key it would be most logical to play a melody in a C Major scale. Even though your rhythm guitar is playing other chords, all the chords you stated belong to the C major scale.
Yes, you can play other scales or modes as suggested by Chochos that's plenty ok, and you should allow yourself the freedom to explore this avenue. But the basic question is can you play a C major scale while your rhythm guitar is playing a F major chord, and the answer is yes, because F major is the subdominant chord for the key of C major.
Recall that in a major scale I = the tonic (in the Key of C that would be a C major chord),
while you have II for the super tonic, in a major key this is minor and it should be written as ii.
The entire chord scheme for a major scale is as follows:
I – ii – iii – IV – V – vi – vii°
(major, minor, minor, major, major, minor, diminished)
tonic, supertonic, mediant, subdominant, dominant, submediant, leading tone
The important thing to understand here is that melodies are relative to the key signature for tonal music. Tonal music defines a tonal center, in this case, C. If you listen to Bach or Handel's music you will find shifts in key centers, these are called modulations, and this only means that the music 'modulates' from one key to another and so does the harmonic and melodic structure shift to a new key center.
Additionally, since you mention you are playing Bluegrass, consider that this idiom allows for many alterations to scale as in bending notes per fiddle, guitar, or banjo. For instance in Blues the 3rd scale degree is often played both minor and major in the same measure.