SNP ministers are accused of having "flunked" their record on education and narrowing the life chances of the poorest pupils in the process.