I'm a math professor. I get asked to write a number of recommendation letters to graduate schools where my honest view of the candidate is "this student would fall somewhere in the bottom 25-50% of their student body. I expect there will be dozens of applicants of similar quality and I have no reason to favor this one except that I have a good personal relationship with him or her."
Logically, this candidate deserves to go as much as any of the dozen similar people in the pool, but I feel that a letter which said the above would be a real disservice to them. Should I refuse to write them? Describe their accomplishments and pointedly ignore that (if my estimates are right) they don't particularly make them stand out?