This is what helps me concentrate at school. I thought I should share it here.
Set aside a certain time each day to daydream (it helps if you make it a regular part of your routine). When you feel like daydreaming at work/school, tell yourself that you can daydream later at the appointed time. I've found it's easier to resist the urge to daydream when I know I can daydream later. (This might not work if you have a really severe case of MD, though.)