Dealing with a coauthor whose contribution was not used in the paper
Based on what you write they did not contribute to the manuscript or the results described therein either due to lack of ability or due to laziness. I also assume they did not contribute any useful ideas. Thus, they are not a coauthor. It's as simple as that. The ICMJE criteria are useful for assessing if someone is an author.

In principle, this is independent of any considerations regarding their conduct in the course project. However, you should have reported their lack of useful contribution to the teacher since they would probably benefit from repeating the course. The problem now is that they could claim to be a coauthor since you put their name on your report and didn't tell the teacher. If the teacher sees the publication they could indeed assume academic dishonesty. Thus, I see two options: 


Include this person as a coauthor and ask them to make a meaningful contribution since you probably have to rewrite most of your project paper to make it suitable for publication.
Explain the situation to your teacher, so you can move forward without getting in trouble with your school.


They chose to not make a valid contribution. Not being a coauthor is a consequence of that choice. Why do you care if that offends them?