Rapid and accurate clinical diagnosis of pathological conditions remains highly challenging. A very important component of diagnosis tool development is the design of effective classification models with Mass spectrometry (MS) data. Some popular Machine Learning (ML) approaches have been investigated for this purpose but these ML models require time-consuming preprocessing steps such as baseline correction, denoising, and spectrum alignment to remove non-sample-related data artifacts. They also depend on the tedious extraction of handcrafted features, making them unsuitable for rapid analysis. Convolutional Neural Networks (CNNs) have been found to perform well under such circumstances since they can learn efficient representations from raw data without the need for costly preprocessing. However, their effectiveness drastically decreases when the number of available training samples is small, which is a common situation in medical applications. Transfer learning strategies extend an accurate representation model learnt usually on a large dataset containing many categories, to a smaller dataset with far fewer categories. In this study, we first investigate transfer learning on a 1D-CNN we have designed to classify MS data, then we develop a new representation learning method when transfer learning is not powerful enough, as in cases of low-resolution or data heterogeneity. What we propose is to train the same model through several classification tasks over various small datasets in order to accumulate generic knowledge of what MS data are, in the resulting representation. By using rat brain data as the initial training dataset, a representation learning approach can have a classification accuracy exceeding 98% for canine sarcoma cancer cells, human ovarian cancer serums, and pathogenic microorganism biotypes in 1D clinical datasets. We show for the first time the use of cumulative representation learning using datasets generated in different biological contexts, on different organisms, in different mass ranges, with different MS ionization sources, and acquired by different instruments at different resolutions. Our approach thus proposes a promising strategy for improving MS data classification accuracy when only small numbers of samples are available as a prospective cohort. The principles demonstrated in this work could even be beneficial to other domains (astronomy, archaeology...) where training samples are scarce.