Terahertz time-domain spectroscopy enables the extraction of electrical properties from materials. An extraction of the complex permittivity can be carried out with measurements in transmission or reflection geometry enabling the identification of materials. To perform an exact identification, the sample thickness and the angle of incidence of the terahertz radiation must be known. However, when those parameters are unknown and additionally the materials show strong absorbances, a precise differentiation between materials is challenging. A promising approach is the use of a neural network for automated material classification of terahertz images from different materials. Here, we show that a trained neural network can differentiate between 16 3D printed dielectric materials with a high accuracy of 98 % from measurements taken in transmission mode. As the constitution of the dataset has a big impact on the accuracy, various data preparations were investigated as well as the number of traces needed for achieving a well-trained network was determined. Finally, the trained neural network was evaluated with different sample thicknesses, revealing the huge impact of the materials absorbance on the extrapolation ability. This approach can be used in security application to classify harmful substances as well as for the automated generation of material maps.