あげくmeaning at the end of all your efforts you put in.
In this sentence, you can still use it if you change ”先生と相談のあげく" to "先生と相談したあげく" seen as in below.
You can use below sentence when you consulted with others first such as your fiends and family and/or mentors. Then, "at the end" when you consulted with your teacher and you finally made up your mind not to drop out. Then, this sentence works.
Hope it helps. :)
先生と相談したあげく、退学をしないことにした。