I mean, OK, but that's only because the second part of your comparison isn't a federal government responsibility and there are only certain targeted initiatives (mostly pork-barrel) that fall into that category. Same for federal spending on education.
But when you look at all government spending on education, it's very clear that we spend more on education (5% of GDP, not counting loan guarantees) than on defense (3.7% of GDP). Except education is funded by local government whereas defense is funded by the federal government.