The player must be a Human Noble , any other origins and you will not be able to marry Alistair.
It's not certain, it could be due to the fact Alistair is a Templar, however he can still be involved with Mages.
As stated above player must be of the Human Noble Origin, however it is still possible to be his consort.
Additionally: Mages, by law, cannot hold any royal title. See: Castle Redcliffe, Connor.