The man was working for a company that produces helicopter parts, often for the German military.
He had to take a security clearance test by the German Economic Affairs Ministry and did not pass because of his membership with the Church of Scientology.
The mechanic argued that he was simply a member and that Scientology as his religion should be a private matter.
But the court on Tuesday ruled that denying him security clearance for classified materials was justifiable, in particular because Scientologists are required to go through auditing - a sort of confessional counseling in which their thoughts and experiences are kept on record.
The court explained that this practice rightly leaves doubt about Scientologists' trustworthiness with classified materials and their loyalty to the constitution.
The court further said that this decision did not violate the man's right to freedom of religion.
The German government does not recognize Scientology as a religion, unlike in the United States, and tends to view the organization with a high level of scepticism.
Courts have ruled in the past that the group is engaged in activities that are subversive to freedom and democracy and should be subject to closer surveillance.