The former first minister is taking the Scottish government to court to challenge how the case has been handled.