Let's take two archetypal rags - Black and White Rag and The Entertainer.
The left hand mostly plays a steady pattern of a bass note on the 1 and 3, and a chord on the 2 and 4.
1 2 3 4 1 2 3 4
LH chord * * * *
LH bass * * * *
Pretty much all ragtime has this regular oom-pah backing throughout, along with lead-ins and linking patterns.
But lots of musical styles have a backing just like this. What makes it ragtime is the syncopated rhythm of the right hand:
The Black and White Rag melody (ignoring the intro and the anacrusis and going straight to the main melody) is a 3 note pattern of half-notes:
1 2 3 4 1 2 3 4
High note * * * * *
Mid note * * * * *
Low note * * * * *
---------------------------
LH chord * * * *
LH bass * * * *
Notice how the melody notes line up with the left hand - it's creating a polyrhythm in which the 3 note "pulse" of the melody comes in and out of phase with the basic left-hand 4/4 rhythm. But, at the end of two bars, the pattern varies, to "reset" and re-anchor the melody to the left-hand.
The first two bars of The Entertainer do the same thing, but with rests in place of some of the melody notes:
1 2 3 4 1 2 3 4
High note *
Mid note * * * *
Low note * * * *
---------------------------
LH chord * * * *
LH bass * * * *
(I've fudged melody, but not the timing, of the last three notes, just to squeeze it into three pitches)
This shows the syncopation more strongly - we hear the two-note pattern once with the first note on the downbeat, once with the first note just after the upbeat (and the second note on the downbeat), once with the first note on the upbeat.
Because the second note is higher, and the tonic, it feels like the accent of the melody, and it comes
- first time, half a beat after the downbeat,
- second time, on a downbeat,
- third time, half a beat before a downbeat.
It's that shifting accent relative to the steady left-hand rhythm that makes ragtime.
I'd suggest working through your favourite rags, to see how the various sections have similar polyrhythms. Then try and replicate that in your own patterns.