The German government has accused Elon Musk of trying to meddle in the country’s election campaign with repeated endorsements of the far-right party AfD.