Abstract Background Deep learning has demonstrated diagnostic performance in electrocardiogram (ECG) analysis comparable to that of clinicians. However, existing models primarily excel in diagnosing common conditions such as arrhythmias and heart blocks, which are easily identifiable using standard predictor variables. Conversely, models aiming to uncover novel insights, such as detecting structural changes or the presence of myocardial scar, often lack generalizability due to insufficient data, model architecture limitations, and other factors. Moreover, these models frequently encounter challenges, such as a decline in performance when applied to external datasets. To address these issues comprehensively, we propose the ECGWiz — a unified model capable of tackling diverse ECG-related problems with consistently high performance. Objective To develop a generalizable Foundation AI model for ECG diagnosis capable of detecting diverse cardiac abnormalities and diseases using few training samples. Methods We utilized publicly available datasets like PTB-XL, CPSC, etc. To build our model, totaling approximately 80,000 ECGs. These 12 lead ECGs are scaled and filtered before using them for training. The AI model is pretrained using Self Supervised Learning and Contrastive Learning strategies. Further, the model undergoes supervised training using a hierarchy of labels that increase in granularity, encompassing arrhythmias, heart blocks, other cardiac abnormalities, heart failure, sudden cardiac death and more. Lastly, the model is prepared for Few-Shot Learning — where the model learns from a minimal set of samples (5 to 10 ECGs) of the target disease. For testing the model, we are using unique datasets like PROSE which consists of non-ischemic cardiomyopathy patients with and without myocardial scaring detected using cardiac MRI imaging at the Johns Hopkins University. Results Our model, trained on a dataset of only 5 ECG recordings, demonstrated a 74% accuracy in identifying myocardial scarring as detected by LGE MRI, utilizing a standard 12-lead ECG. This performance is comparable to that of conventional deep learning methods, which necessitate datasets containing upwards of 120 ECG recordings. Conclusion Our model represents a promising stride in creating a unified and adaptable foundation AI model for comprehensive ECG-based diagnosis. Its capacity to learn from a minimal set of examples signifies a robust framework that can evolve and adapt to new challenges in ECG diagnosis. Ongoing improvements, particularly through dataset expansion, underscore its potential to enhance cardiovascular diagnostics, offering precise and efficient patient care.