May, 60, visited the temple in Neasden and offered flower petals at the central shrine of Bhagwan Swaminarayan yesterday, a temple spokesperson said.
After meeting young and old volunteers of BAPS Swaminarayan Sanstha, she also met with leaders of other Hindu organisations, the spokesperson said.
In a 20-minute speech, May told around 2,000 worshippers to help her make Britain the "world's great meritocracy".
May also praised UK-Indians for being "inspiring role models across all walks of life" and said their achievements were built "on the very best of British and Indian values".
More From This Section
May was accompanied by her husband Philip and both removed their shoes before entering the temple, the spokesperson said, adding that she was presented with a traditional memento before her departure.
The visit came during May's last weekend campaigning as the UK gears up to vote in the snap general election she called earlier this year on June 8.