Let's break the sentence down:
遅刻する = to be late;
と = conjunction that in this case can be translated with "and" (in the sense of cause/effect);
やばい = depending on the context, means either something like "awful", "terrible", "risky" etc, or quite the opposite "terrific", "amazing", etc. In this case is easy to guess which meaning it has though.
んだ = colloquial for のです. Here can be translated simply with "is/is going to be" (referred to what comes before that). You can find a lot of references about the んです/のです if you search a bit.
けど = "but","although". In this case probably can be just translated as "though".
な = is a sentence ending (I think mainly used by men) to indicate emphasis/emotion.
So you can translate your sentence as: It's gonna be terrible if I'll be late though.
Given the context it seems to me that the hero wants to help the lady but ad the same time complains (with himself?) that it will be bad if (because of that) he will be late for work (maybe there is something particularly important that day at work?). If this is correct, a more free translation could also be "Oh man, it's gonna be terrible if I'll be late though....
In particular, about けど, you can also look at this question.