Possibly, if they know the student well. You should only write a recommendation letter for a candidate if you believe you'll be able to speak highly about them. Even if you think they are a good student, it is okay to decline writing a reference letter if you don't think you know the student well enough.