Is there a way to get rid of absentmindedness?

Check for ADHD. Your age would help to narrow the possible findings. Get a good neuro exam, check your thyroid, and start with a self assessment for adhd and anxiety. If you are older than 50 or older (and especially if you have a history in the family of alzheimers, that could be possible (note i said could) check the internet for memory improvement. Stay physically and mental active (reading, thinking games).