The Federal Constitutional Court late Saturday upheld rulings by two lower tribunals that the free-speech rights of the National Party of Germany (NPD) had not been violated.
ZDF public television had opted not to show the NPD commercial for next month's European elections, which claimed that “migration kills” and called for “protection zones” for Germans.
The broadcaster had decided that the advert amounted to incitement of racial hatred, a crime in Germany. The NPD disputed this claim in a Facebook post on Thursday.
ZDF's assessment had been backed by the superior administrative court in Rhineland-Palatinate state as well as the administrative court in Mainz, where ZDF is based.
The Constitutional Court said in a statement that it had rejected the NPD's appeal as there were “no grounds to think that the courts failed to uphold the plaintiff's freedom of speech”.
Fellow public broadcaster ARD has also refused to show the commercial, which was due to run from April 29 to May 15. It said it was unaware of any legal challenge to the decision by the NPD.
The NPD has seats in many town halls in the ex-communist east of the country but has negligible poll ratings at the national level.
Germany's upper house of parliament lost a bid in 2017 to ban the NPD, as the Constitutional Court ruled the xenophobic fringe group was too insignificant to pose a real threat to the democratic order.
The far-right AfD party, which has also railed against Chancellor Angela Merkel's decision to allow in more than one million asylum seekers during a 2015-16 influx, is polling around 10 percent ahead of the European Parliament elections.