Q. Can I as a female stay in a dorm? I cannot concentrate at home. I would be staying with my friend. Can she be my mahram?
Answer: Your friend (or blood sister) cannot be your mahram. It is against the protocols of religion. More so when it is known that you have a home and mahrams are willing to take care of you in a responsible manner.
Your solution would be to create an environment within your home to study. Or go to a local library to help yourself keep focused. It is best to be with a mahram so as to avoid any type of disgraceful actions. Never be alone with a male, be in a publicly visible area so as to avoid being tempted to that which is forbidden. Never allow yourself to be seated alone with a strange man.
The dormitory would not be a solution for your studies. It generally would compound to other problems. It would be best to stay away from such an environment whenever possible.
Allah Certainly knows best.