No, barbarians in D&D 5e do not have access to spellcasting or cantrips through their class features, unless they multiclass into a spellcasting class or gain abilities through specific feats or racial traits that allow them to cast cantrips.