Genes and alleles are related because alleles are inside a gene. Allele is defined with each of two or more alternative forms of a gene. Whereas gene, are found at the same position in a chromosome.
In population genetics, allele frequency is used to reflect the genetic diversity of a population species.
Here is an interesting calculator of how to calculate Allele Frequency i.e P frequency and Q frequency.
Use this online calculator to estimate the relative frequency of a
variant of a gene in a specific population using Hardy-Weinberg