BERLIN—The Trump administration has told the German government it would limit intelligence sharing with Berlin if Huawei Technologies Co. is allowed to build Germany’s next-generation mobile-internet infrastructure.

In a letter to the country’s economics minister, U.S. Ambassador to Germany Richard A. Grenell wrote allowing the participation of Huawei or other Chinese equipment vendors in the 5G project would mean the U.S. won’t be able to maintain the same level of cooperation with German security agencies.

The...