Two warring tech giants are taking their battle to the schoolyard -- or at least the classroom.

Microsoft Corp. (NASDAQ:MSFT) is throwing its weight behind a Massachusetts bill that would ban companies from using cloud-computing services to mine student data for commercial purposes. The bill, introduced in January, is the first of its kind in the country, and it would essentially prohibit the use of data collected when kids use computers at public schools. Microsoft is ostensibly backing the bill on privacy grounds, but it is not being coy about the fact that its real target is its arch nemesis, Google Inc. (NASDAQ:GOOG), whose growing portfolio of cloud-based services such as Google Drive is an encroaching threat on Microsoft’s erstwhile Office suite.

According to the Wall Street Journal, Microsoft acknowledges that the bill is aimed at Google’s business practices. Mike Houlihan, a Microsoft spokesman, told the Journal: “We believe that student data should not be used for commercial purposes; that cloud-service providers should be transparent in how they use student data; and that service providers should obtain clear consent for the way they use data. We expect that students, parents and educators will judge any proposed legislation on its merits."

Unlike Office’s desktop-based software, Google Drive allows users to create documents and spreadsheets in a cloud. The trade-off, of course, is that Google can collect users’ data and run advertising based on keywords within documents.

In a classroom setting, Google offers Apps for Education, which provides free cloud-based tools such as email, calendars and documents for collaborative use. Google says ads are turned off by default in Apps for Education, but Microsoft argues that turning off ads does not prohibit the mining of data for commercial use.

According to section one of the bill, “[A]ny person who provides a cloud computing service to an educational institution operating within the State shall process data of a student enrolled in kindergarten through twelfth grade for the sole purpose of providing the cloud computing service to the educational institution and shall not process such data for any commercial purpose, including but not limited to advertising purposes that benefit the cloud computing service provider.”

The Massachusetts bill is Microsoft’s latest attempt to chip away at Google’s increasing market dominance. The Redmond, Wash., tech firm spent millions lobbying in support of the U.S. government’s antitrust investigation into Google’s search practices, which critics argued favored Google’s own products in search results over the products of its competitors. The Federal Trade Commission ultimately found that Google had not violated antitrust laws.

More recently, Microsoft has stepped up efforts in its ongoing “Scroogled” ad campaign, arguing that Google’s Gmail service violates users’ privacy by displaying advertising related to the content of personal emails. Most email programs -- including Microsoft's Hotmail -- scan users’ messages for the purposes of keeping out spam, but Microsoft defends its criticism of Google on the grounds that it uses this scanned content for targeted advertising.

The Massachusetts bill, MA Bill 331, is in the process of being referred to the legislature’s joint education committee -- so it could be a while before state lawmakers weigh in. In the meantime, watch one of Microsoft’s latest anti-Google attacks below.