I'm sure everyone who has played music has experienced this: You're working your way through a new piece of music. You struggle to stay in the key signature, trying to remember the correct articulations and fingerings. Meanwhile, you may be completely disregarding the rhythm, thinking: "Ah, I'll get to that later." Occasionally my students will admit to me that they're not counting. And I have not-so-fond memories of myself as a young student learning a piece, merely "guestimating" the rhythm. Eek! Stop! Put down your instrument.
Times like these are a perfect opportunity to pull out the metronome. Turn it on, setting it on a nice slow tempo. Set it at half the normal tempo, if you need to. Sometimes it helps to set the instrument aside and simply clap out the rhythm of the music with the metronome on. Try speaking the rhythm (i.e. "1-e-and-a 2-and...), and make sure you know exactly how long or short each note is.
Any basic metronome will work. Most run around $20-30. If you can afford it, the Dr. Beat (DB-90) is the current grandfather of all metronomes -- it actually counts out loud for you in a human-sounding voice. If you happen to practice near a computer (and it has nice loud speakers), you can use an online metronome.
A lot of the time, students who only play music by themselves tend to let their rhythm and counting go by the wayside. That makes it extra-difficult when you attempt to play in an ensemble or with an accompanist! Spend some time with the metronome. It may be frustrating at first, but you (and your teacher) will be glad you did.