The emergence of spatial transcriptomic technologies has opened new avenues for investigating gene activities while preserving the spatial context of tissues. Utilizing data generated by such technologies, the identification of spatially variable (SV) genes is an essential step in exploring tissue landscapes and biological processes. Particularly in typical experimental designs, such as case-control or longitudinal studies, identifying SV genes between groups is crucial for discovering significant biomarkers or developing targeted therapies for diseases. However, current methods available for analyzing spatial transcriptomic data are still in their infancy, and none of the existing methods are capable of identifying SV genes between groups. To overcome this challenge, we developed SPADE for spatial pattern and differential expression analysis to identify SV genes in spatial transcriptomic data. SPADE is based on a machine learning model of Gaussian process regression with a gene-specific Gaussian kernel, enabling the detection of SV genes both within and between groups. Through benchmarking against existing methods in extensive simulations and real data analyses, we demonstrated the preferred performance of SPADE in detecting SV genes within and between groups. The SPADE source code and documentation are publicly available at https://github.com/thecailab/SPADE.