There are two forms of detention you can experience in your dreams. One is a punitive kind (where someone cares about disciplining you) and the other is the guidance-seeking kind where you wish for guidance to learn from your mistakes. Basically, the idea behind dreams of detention is that there has been something in your life that needs to be addressed and maybe punished or sat with and understood.
When people are detained in dream, it usually means they want to take a step back and think about their actions or their needs. Detention refers to a restriction of freedom. In this sense, what prevents them from moving ahead is their bad behavior and self-reflection that’s important for enjoying life. The person may fear being punished for their mistakes so self-worth takes an emotional hit from the anxiety which leads to lessening of personal power.