BEIJING — The advertisement for sperm donors was exacting.

No bald men. No hereditary diseases like color blindness. And in case there were any doubts, the sperm bank at Peking University Third Hospital clarified: Only men with an abiding love for the “socialist motherland” need apply.

President Xi Jinping’s drive to restore the Communist Party’s place at the center of everyday life in China has brought socialist banners to city streets, nationalistic rap music to the airwaves and patriotic heroes to movie theaters. Now Mr. Xi has inspired a new test of party loyalty — reproduction.

The ad placed by the hospital sperm bank, which has circulated widely on social media in recent days, listed support for the Communist Party and Mr. Xi as its top requirements for potential donors.

“He must have good ideological thoughts,” the ad said by way of describing ideal donors, “love the socialist motherland and support the leadership of the Chinese Communist Party.”

Those men who were approved to donate could earn up to 5,000 renminbi, about $800, according to the ad. About 19 percent of the hospital’s applicants are accepted, according to a 2016 news report.

The ad, widely mocked on social media, was later removed.

“Love for the country and the party starts from sperm,” one user sarcastically wrote on Weibo, a microblogging site.

Several commenters questioned the basis for the criteria. The ad also said that donors needed to be law-abiding, “honest and upright” and free of “political issues.”

“Where is the scientific proof?” another Weibo user wrote.

A staff member at the Peking University Third Hospital, reached by telephone, declined to comment.

Mr. Xi’s demands for unflinching party loyalty have been known to encourage overzealous action from officials eager to prove their devotion. Critics have said Mr. Xi is encouraging the return of a personality cult unseen since the days of Mao Zedong.

Under Mr. Xi, government officials have also spoken frequently about the need to instill the so-called “red gene” in younger generations, a reference to carrying on the Communist tradition.

The ad comes at a time when Chinese sperm banks are facing pressure to attract donors, as more families seek to have a second child following the relaxation of the one-child policy. The country faces intense pressure to grow its labor force as its society ages, and some sperm banks have resorted to using patriotic calls to persuade young men to donate.

Some were skeptical of the ad’s significance, noting that it appeared to be an isolated case.

Hu Xijin, the editor of Global Times, a staunchly nationalistic mainland newspaper, said the ad was “ridiculous” and seemed aimed at stirring up critical news reports.

“Leaders of this kind of organization who made this kind of accident should be asked to take responsibility and be given punishment,” Mr. Hu wrote in a Weibo post.